-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 1.71 KB
/
go-cdk-diff.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
on:
workflow_call:
inputs:
env:
required: true
type: string
jobs:
aws_cdk:
runs-on: ubuntu-latest
container:
image: ghcr.io/useheartbeat/heartbeat-go-cdk-dockerfile:main
credentials:
username: hbh-github
password: ${{ secrets.GH_TOKEN }}
permissions:
id-token: write
contents: read
name: Diff
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get modules
working-directory: ./cdk-infra
run: |
go mod download
- name: Determine IAM Role
id: iam
env:
ENV: ${{ inputs.env }}
run: |
[[ "$ENV" == "prod" ]] && echo "iam_role=arn:aws:iam::098444936620:role/GitHubRole" >> $GITHUB_OUTPUT || echo "iam_role=arn:aws:iam::701248519518:role/GitHubRole" >> $GITHUB_OUTPUT
- name: Configure AWS credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ steps.iam.outputs.iam_role }}
aws-region: us-east-1
role-session-name: actions-${{ inputs.env }}
- name: Clear context
working-directory: ./cdk-infra
run: cdk context --clear
- name: Synth
working-directory: ./cdk-infra
run: cdk synth -c envName=${{ inputs.env }}
- name: Diff
working-directory: ./cdk-infra
run: cdk diff -c envName=${{ inputs.env }}