Skip to content

Commit

Permalink
new approach for labels; shared if condition to env
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-vakil committed Jul 24, 2024
1 parent d75cfbd commit f75002f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/workflow_build_and_release_containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ run-name: 'Build images and create release'
on:
workflow_dispatch:
pull_request:
paths-ignore:
types: [opened, reopened, synchronize, labeled, ready_for_review]
paths-ignore:
- README.md
push:
branches:
Expand Down Expand Up @@ -51,8 +52,17 @@ jobs:
run: |
dotnet tool install --global Octopus.DotNet.Cli --version 9.1.7
dotnet octo --version
- name: determine if we should create release and deploy
id: should-create-release
run: |
if [[ ${{ github.ref_name == 'main' || github.pull_request.labels.*.name == 'deploy-to-sandbox' }} ]]; then
echo "SHOULD_CREATE_RELEASE=true" >> $GITHUB_ENV
else
echo "SHOULD_CREATE_RELEASE=false" >> $GITHUB_ENV
fi
echo "should run: ${{ env.SHOULD_CREATE_RELEASE }}"
- name: Create Octo Release if main or deploy to sandbox label present
if: ${{ github.ref_name == 'main' || github.event.label.name == 'deploy-to-sandbox' }}
if: env.SHOULD_CREATE_RELEASE == 'true'
run: |
octoSpaceId="Spaces-1"
octoProjectId="Projects-2241"
Expand All @@ -61,7 +71,7 @@ jobs:
--gitRef=main --server=${{ vars.OCTOPUS_CLOUD_URL }} --apiKey=${{ secrets.OCTOPUS_CLOUD_API_KEY }}
# Note: The gitRef param is for the Octo config repo and not the git repo for the code
- name: Deploy via Octopus if main or deploy to sandbox label present
if: ${{ github.ref_name == 'main' || github.event.label.name == 'deploy-to-sandbox' }}
if: env.SHOULD_CREATE_RELEASE == 'true'
run: |
octoSpaceId="Spaces-1"
octoProjectId="Projects-2241"
Expand Down

0 comments on commit f75002f

Please sign in to comment.