-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.3 KB
/
go-cdk-deploy.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
69
70
71
72
73
74
75
76
77
on:
workflow_call:
inputs:
env:
required: true
type: string
account-id:
required: true
type: string
jobs:
aws_cdk:
runs-on: ubuntu-latest-m
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: Deploy
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: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ inputs.account-id }}:role/GitHubRole
role-session-name: actions-${{ inputs.env }}
aws-region: 'us-east-1'
- name: Clear context
working-directory: ./cdk-infra
run: cdk context --clear
- name: Deploy User stack
id: cdk-deploy-user
working-directory: ./cdk-infra
run: cdk deploy --require-approval never -c envName=${{ inputs.env }} HBHPartnerUserPoolStack HBHPartnerUsers
- name: Clear context
working-directory: ./cdk-infra
run: cdk context --clear
- name: Deploy GW stack
id: cdk-deploy-gw
working-directory: ./cdk-infra
run: cdk deploy --require-approval never -c envName=${{ inputs.env }} HBHPartnerImportVpcStack HBHPartnerApiGwStack
- name: Post failed status
if: ${{ always() && steps.cdk-deploy-gw.outcome != 'success' && github.actor != 'renovate[bot]'}}
uses: act10ns/slack@v2.1.0
with:
status: ${{ steps.cdk-deploy-gw.outcome }}
channel: '#alerts-severe'
message: Build ${{ steps.cdk-deploy-gw.outcome }}, logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_SEVERE }}