-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (77 loc) · 2.3 KB
/
deployment.yml
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
name: Access Logs Deployment
on:
workflow_dispatch:
push:
branches:
- main
permissions:
id-token: write
contents: write
deployments: write
jobs:
deploy:
name: deploy ${{ matrix.environment }}
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
environment: [dev, preprod, prod]
include:
- environment: dev
assume_role: arn:aws:iam::123456789100:role/githubActionsOidc
region: us-east-1
- environment: preprod
assume_role: arn:aws:iam::123456789101:role/githubActionsOidc
region: us-east-1
- environment: prod
assume_role: arn:aws:iam::123456789102:role/githubActionsOidc
region: us-east-1
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
id: checkout
- name: Set up node
uses: actions/setup-node@v3
id: set-node
with:
node-version: 16
check-latest: true
- name: Configure credentials
id: aws-creds
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: ${{ matrix.assume_role }}
role-duration-seconds: 1200
aws-region: ${{ matrix.region }}
- name: Install dependencies
id: npm-i
run: npm install
- name: Create GitHub deployment
uses: chrnorm/[email protected]
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: ${{ matrix.environment }}
- name: Run deployment
id: deploy
run: |
npx cdk deploy "*" -c config=$ENVIRONMENT --require-approval never
env:
ENVIRONMENT: ${{ matrix.environment }}
- name: Update deployment status (success)
if: success()
uses: chrnorm/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
state: success
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
state: failure
deployment-id: ${{ steps.deployment.outputs.deployment_id }}