Skip to content

Merge pull request #515 from lzim/Test #85

Merge pull request #515 from lzim/Test

Merge pull request #515 from lzim/Test #85

# This is a basic workflow to help you get started with Actions
name: UploadModel
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, Test, Dev ]
paths:
- '**.mdl'
#pull_request:
#branches: [master, Test]
#types: [closed]
#paths:
#- '**.mdl'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
getFileNameList:
# The type of runner that the job will run on
runs-on: ubuntu-latest #windows-latest #ubuntu-latest
outputs:
outputFileName: ${{ steps.getFileName.outputs.fileName }}
outputBranchName: ${{ steps.extract_branch.outputs.branch }}
#output2: ${{ steps.step2.outputs.test }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- id: changedFiles
uses: jitterbit/get-changed-files@v1
- name: Extract branch name
#shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Set branch name
id: setSimUIBranchName
run: |
if ${{ steps.extract_branch.outputs.branch == 'master'}} ; then
echo "::set-output name=BranchName::main"
elif ${{ steps.extract_branch.outputs.branch == 'Test'}}; then
echo "::set-output name=BranchName::Test"
elif ${{ steps.extract_branch.outputs.branch == 'Dev'}}; then
echo "::set-output name=BranchName::Dev"
fi
- name: '' #get changed files
id: getFileName
run: |
chmod +x .github/workflows/changedFilesFilter.sh
awk '{ sub("\r$", ""); print }' .github/workflows/changedFilesFilter.sh > .github/workflows/changedFilesFilter2.sh
mv .github/workflows/changedFilesFilter2.sh .github/workflows/changedFilesFilter.sh
chmod +x .github/workflows/changedFilesFilter.sh
echo "::set-output name=fileName::$(.github/workflows/changedFilesFilter.sh "${{ steps.changedFiles.outputs.added_modified }} ${{ steps.changedFiles.outputs.renamed }}")"
- name: Uploading Model to another Repository (jamesmrollins/sim_ui)
run: |
chmod +x .github/workflows/UploadingModelUtility.sh
awk '{ sub("\r$", ""); print }' .github/workflows/UploadingModelUtility.sh > .github/workflows/UploadingModelUtility2.sh
mv .github/workflows/UploadingModelUtility2.sh .github/workflows/UploadingModelUtility.sh
chmod +x .github/workflows/UploadingModelUtility.sh
.github/workflows/UploadingModelUtility.sh "blue/mtl3.0_models/*.vmfx" 'jamesmrollins/sim_ui' "${{ steps.setSimUIBranchName.outputs.BranchName }}" 'model' '[email protected]' 'hirenp-waferwire' "Model file is Uploaded by ${{ github.event.repository.name }}" "${{ secrets.API_TOKEN_GITHUB }}"
- name: File Name List
run: |
echo ${{ steps.getFileName.outputs.fileName }}
UploadModel:
# The type of runner that the job will run on
runs-on: windows-latest
needs: getFileNameList
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: "0"
#- name: '' #get changed Dir Name
# id: getDirName
# run: |
# echo "::set-output name=dirs::$(dirname ${{ needs.getFileNameList.outputs.outputFileName }})"
- name: '' #get changed Dir Name
id: getSDMDocFile
run: |
echo "::set-output name=SDMDocFile::$(.github/workflows/DevUtility/sdmDocFileCommit.bat "${{ needs.getFileNameList.outputs.outputFileName }}")"
- name: echo output
run: |
echo ${{ steps.getSDMDocFile.outputs.SDMDocFile }}
echo ${{ needs.getFileNameList.outputs.outputBranchName }}
#echo ${{ steps.getDirName.outputs.dirs }}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Set branch name
id: setSimUIBranchName
shell: bash
run: |
if ${{ steps.extract_branch.outputs.branch == 'master'}} ; then
echo "::set-output name=BranchName::main"
elif ${{ steps.extract_branch.outputs.branch == 'Test'}}; then
echo "::set-output name=BranchName::Test"
elif ${{ steps.extract_branch.outputs.branch == 'Dev'}}; then
echo "::set-output name=BranchName::Dev"
fi
- name: SDM Doc
run: '.github\workflows\DevUtility\SDMDocUtility\ConSDM "${{ needs.getFileNameList.outputs.outputFileName }}" "${{ github.workspace }}\"'
- name: Commit SDM-Doc File
if: ${{ steps.extract_branch.outputs.branch != 'master' && steps.extract_branch.outputs.branch != 'main' && steps.extract_branch.outputs.branch != 'Test' }}
run: |
git config user.name github-actions
git config user.email [email protected]
git add -- ${{ steps.getSDMDocFile.outputs.SDMDocFile }}
git commit -m'SMD Doc Commit' -- ${{ steps.getSDMDocFile.outputs.SDMDocFile }}
git push origin Dev
- name: Uploading SDM DOC to another Repository (jamesmrollins/MTL-DEMO)
if: always()
run: |
chmod +x .github/workflows/UploadingDemoSDDOCUtility.sh
awk '{ sub("\r$", ""); print }' .github/workflows/UploadingDemoSDDOCUtility.sh > .github/workflows/UploadingDemoSDDOCUtility2.sh
mv .github/workflows/UploadingDemoSDDOCUtility2.sh .github/workflows/UploadingDemoSDDOCUtility.sh
chmod +x .github/workflows/UploadingDemoSDDOCUtility.sh
.github/workflows/UploadingDemoSDDOCUtility.sh "blue/mtl3.0_models/*-A.html" 'jamesmrollins/MTL-DEMO' "${{ steps.setSimUIBranchName.outputs.BranchName }}" 'static' '[email protected]' 'hirenp-waferwire' "SDM DOC file is Uploaded by ${{ github.event.repository.name }}" "${{ secrets.API_TOKEN_GITHUB }}"
shell: bash