Publish-CloudFormation-foo #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish-CloudFormation-foo | |
on: | |
create: | |
push: | |
branches: | |
- main | |
- "[0-9]+.[0-9]+" | |
paths: | |
- deploy/cloudformation/*.yml | |
- scripts/publish_cft.sh | |
- .github/workflows/publish-cloudformation.yml | |
env: | |
GH_TOKEN: ${{ github.token }} | |
permissions: | |
actions: "write" | |
jobs: | |
publish_cloudformation_foo: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Branch and Event Type | |
run: | | |
if [[ ${{ github.event_name }} == 'create' ]]; then | |
if [[ ${{ github.ref }} =~ ^refs/heads/[0-9]+\.[0-9]+$ ]]; then | |
echo "Branch creation event and name matches the pattern. Proceeding with the workflow." | |
else | |
echo "Branch creation event, but the branch name doesn't match the pattern. Exiting the workflow." | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
fi | |
else | |
echo "Not a branch creation event. Proceeding with the workflow." | |
fi | |
- name: Publish CloudFormation | |
run: | | |
echo "Publishing CloudFormation" |