Skip to content

Commit

Permalink
TID-4 Moved to single GHA workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
captaincoordinates committed Mar 4, 2024
1 parent cdda9b1 commit 86dc293
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 52 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/diff.yaml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Validate and Test

on:
push:
branches:
- '*'

jobs:
test:
name: Validate and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Test
run: scripts/run-tests-in-container.sh
deploy_diff:
needs: ["test"]
name: Diff IaC changes
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{vars.GHA_AWS_DEPLOY_ROLE}}
aws-region: us-west-2
- name: Checkout repo
uses: actions/checkout@v2
- name: Install dependencies
run: cd iac/ && npm install
- name: CDK Diff
env:
AWS_ACCOUNT: ${{ secrets.CDK_DEPLOY_ACCOUNT }}
AWS_REGION: ${{ env.AWS_REGION }}
run: export PATH=node_modules/aws-cdk/bin:$PATH && bash ./scripts/deploy.sh DIFF
deploy:
if: github.ref == 'refs/heads/main'
needs: ["deploy_diff"]
name: Deploy IaC
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{vars.GHA_AWS_DEPLOY_ROLE}}
aws-region: us-west-2
- name: Checkout repo
uses: actions/checkout@v2
- name: Install dependencies
run: cd iac/ && npm install
- name: CDK Deploy
env:
AWS_ACCOUNT: ${{ secrets.CDK_DEPLOY_ACCOUNT }}
AWS_REGION: ${{ env.AWS_REGION }}
run: export PATH=node_modules/aws-cdk/bin:$PATH && bash ./scripts/deploy.sh
15 changes: 0 additions & 15 deletions .github/workflows/test.yml

This file was deleted.

5 changes: 2 additions & 3 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ if [ $1 = "DIFF" ]
then
CMD="diff"
else
CMD="deploy"
CMD="deploy --require-approval never"
fi

cdk $CMD \
-c aws_region=$AWS_REGION \
-c aws_account=$AWS_ACCOUNT \
--require-approval never
-c aws_account=$AWS_ACCOUNT

0 comments on commit 86dc293

Please sign in to comment.