Skip to content

Merge pull request #21 from fcdeveloper00/patch-2 #22

Merge pull request #21 from fcdeveloper00/patch-2

Merge pull request #21 from fcdeveloper00/patch-2 #22

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: CreateLP5SamplesZip
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- DownloadableCodeProjects/LP5_file-io-json-async/**
defaults:
run:
shell: pwsh
jobs:
create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create LP5 SampleApps zip
run: |
cd ./DownloadableCodeProjects/LP5_file-io-json-async
rm -f ../Downloads/LP5SampleApps.zip
zip -r -q ../Downloads/LP5SampleApps.zip $(git ls-files)
- name: Commit and push
uses: Endbug/add-and-commit@v7
with:
add: '["DownloadableCodeProjects/Downloads/LP5SampleApps.zip"]'
message: 'Updating Zip with sample app source files'
push: true