|
| 1 | +# This workflow is triggered on two events: workflow_dispatch and push. |
| 2 | +# |
| 3 | +# - The workflow_dispatch event allows you to manually trigger the workflow from GitHub's UI. |
| 4 | +# - The push event triggers the workflow whenever there's a push to the master branch, but only |
| 5 | +# if the changes include files in the LearnModuleExercises/SampleApps/** directory. |
| 6 | +# |
| 7 | +# The defaults section sets the default shell for all run commands in the workflow to PowerShell (pwsh). |
| 8 | +# |
| 9 | +# The workflow consists of a single job named create_zip, which runs on the latest version of Ubuntu. |
| 10 | +# |
| 11 | +# This job has three steps: |
| 12 | +# |
| 13 | +# 1. The Checkout step uses the actions/checkout@v4 action to checkout the repository's code onto the |
| 14 | +# runner. This is a common first step in most workflows as it allows subsequent steps to operate on |
| 15 | +# the codebase. |
| 16 | +# |
| 17 | +# 2. The Create SampleApps zip step changes the current directory to ./LearnModuleExercises/SampleApps |
| 18 | +# and then creates a zip file of all the files in that directory, including those in the .vscode |
| 19 | +# subdirectory. The -r option is used to zip directories recursively and the -q option is used to run |
| 20 | +# the command quietly without printing a lot of output. The resulting zip file is saved in the |
| 21 | +# ../Downloads directory with the name SampleApps.zip. |
| 22 | +# |
| 23 | +# 3. The Commit and push step uses the Endbug/add-and-commit@v7 action to add the newly created zip file |
| 24 | +# to the repository, commit the changes with the message 'Updating Zip for API source files', and then |
| 25 | +# push the changes back to the repository. The add input is set to the path of the zip file and the push |
| 26 | +# input is set to true to enable pushing. |
| 27 | +# |
| 28 | +# This workflow is useful for automatically packaging and versioning sample applications whenever changes |
| 29 | +# are made to them. |
| 30 | +# |
| 31 | +name: CreateAZ2007M5SamplesZip |
| 32 | +on: |
| 33 | + workflow_dispatch: |
| 34 | + push: |
| 35 | + branches: |
| 36 | + - 'main' |
| 37 | + paths: |
| 38 | + - DownloadableCodeProjects/az-2007-m5-refactor-improve-code/** |
| 39 | + |
| 40 | +defaults: |
| 41 | + run: |
| 42 | + shell: pwsh |
| 43 | + |
| 44 | +jobs: |
| 45 | + create_zip: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + - name: Create AZ2007M5 SampleApps zip |
| 51 | + run: | |
| 52 | + cd ./DownloadableCodeProjects/az-2007-m5-refactor-improve-code |
| 53 | + rm -f ../Downloads/AZ2007LabAppM5.zip |
| 54 | + zip -r -q ../Downloads/AZ2007LabAppM5.zip $(git ls-files) |
| 55 | + - name: Commit and push |
| 56 | + uses: Endbug/add-and-commit@v7 |
| 57 | + with: |
| 58 | + add: '["DownloadableCodeProjects/Downloads/AZ2007LabAppM5.zip"]' |
| 59 | + message: 'Updating Zip with sample app source files' |
| 60 | + push: true |
0 commit comments