Skip to content

Merge pull request #13 from MicrosoftLearning/lp6-m2-eric #5

Merge pull request #13 from MicrosoftLearning/lp6-m2-eric

Merge pull request #13 from MicrosoftLearning/lp6-m2-eric #5

Workflow file for this run

# This workflow is triggered on two events: workflow_dispatch and push.
#
# - The workflow_dispatch event allows you to manually trigger the workflow from GitHub's UI.
# - The push event triggers the workflow whenever there's a push to the master branch, but only
# if the changes include files in the LearnModuleExercises/SampleApps/** directory.
#
# The defaults section sets the default shell for all run commands in the workflow to PowerShell (pwsh).
#
# The workflow consists of a single job named create_zip, which runs on the latest version of Ubuntu.
#
# This job has three steps:
#
# 1. The Checkout step uses the actions/checkout@v4 action to checkout the repository's code onto the
# runner. This is a common first step in most workflows as it allows subsequent steps to operate on
# the codebase.
#
# 2. The Create SampleApps zip step changes the current directory to ./LearnModuleExercises/SampleApps
# and then creates a zip file of all the files in that directory, including those in the .vscode
# subdirectory. The -r option is used to zip directories recursively and the -q option is used to run
# the command quietly without printing a lot of output. The resulting zip file is saved in the
# ../Downloads directory with the name SampleApps.zip.
#
# 3. The Commit and push step uses the Endbug/add-and-commit@v7 action to add the newly created zip file
# to the repository, commit the changes with the message 'Updating Zip for API source files', and then
# push the changes back to the repository. The add input is set to the path of the zip file and the push
# input is set to true to enable pushing.
#
# This workflow is useful for automatically packaging and versioning sample applications whenever changes
# are made to them.
#
name: CreateLP6SamplesZip
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- DownloadableCodeProjects/LP6_implement-delegates-events/**
defaults:
run:
shell: pwsh
jobs:
create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create LP6 SampleApps zip
run: |
cd ./DownloadableCodeProjects/LP6_implement-delegates-events
rm -f ../Downloads/LP6SampleApps.zip
zip -r -q ../Downloads/LP6SampleApps.zip $(git ls-files)
- name: Commit and push
uses: Endbug/add-and-commit@v7
with:
add: '["DownloadableCodeProjects/Downloads/LP6SampleApps.zip"]'
message: 'Updating Zip with sample app source files'
push: true