Skip to content

Commit

Permalink
ATO-807: [deploy] Updated branch deployment workflow condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalpaitch committed Aug 1, 2024
1 parent 44349ce commit db21a8c
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/deploy-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@ permissions:
contents: read

jobs:
get-head-commit:
name: Get head commit
runs-on: ubuntu-latest
outputs:
commit-message: ${{ steps.get-head-commit.outputs.commit-message }}
steps:
- name: Checkout Commit
uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_SHA }}
- name: Get Head Commit Message
id: get-head-commit
run: echo "commit-message=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

push-frontend-image:
if: contains(github.event.head_commit.message, '[deploy]') == true
if: contains(needs.get-head-commit.outputs.commit-message, '[deploy]')
name: Push frontend image
needs: get-head-commit
runs-on: ubuntu-latest
environment:
name: demo
Expand All @@ -46,9 +61,9 @@ jobs:
dockerfile: infrastructure/frontend/Dockerfile

deploy-frontend:
if: contains(github.event.head_commit.message, '[deploy]') == true
if: contains(needs.get-head-commit.outputs.commit-message, '[deploy]') == true
name: Deploy frontend (demo)
needs: [ push-frontend-image ]
needs: [ get-head-commit, push-frontend-image ]
runs-on: ubuntu-latest
outputs:
stack-name: ${{ steps.deploy.outputs.stack-name }}
Expand Down Expand Up @@ -118,8 +133,9 @@ jobs:
echo "url=$url" >> "$GITHUB_OUTPUT"
deploy-dynamodb:
if: contains(github.event.head_commit.message, '[deploy]') == true
if: contains(needs.get-head-commit.outputs.commit-message, '[deploy]') == true
name: Deploy dynamodb (demo)
needs: get-head-commit
runs-on: ubuntu-latest
environment:
name: demo
Expand Down Expand Up @@ -170,8 +186,9 @@ jobs:
DeploymentName=${{ steps.get-deployment-name.outputs.pretty-branch-name }}
deploy-cognito:
if: contains(github.event.head_commit.message, '[deploy]') == true
if: contains(needs.get-head-commit.outputs.commit-message, '[deploy]') == true
name: Deploy cognito (demo)
needs: get-head-commit
runs-on: ubuntu-latest
environment:
name: demo
Expand Down Expand Up @@ -223,8 +240,9 @@ jobs:
DeploymentName=${{ steps.get-deployment-name.outputs.pretty-branch-name }}
deploy-api:
if: contains(github.event.head_commit.message, '[deploy]') == true
if: contains(needs.get-head-commit.outputs.commit-message, '[deploy]') == true
name: Deploy API (demo)
needs: get-head-commit
runs-on: ubuntu-latest
environment:
name: demo
Expand Down

0 comments on commit db21a8c

Please sign in to comment.