-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (72 loc) · 2.2 KB
/
Copy pathci.yml
File metadata and controls
77 lines (72 loc) · 2.2 KB
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: CI-CD
on:
pull_request:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
inputs:
deploy_target:
description: "Deploy target environment"
required: false
default: none
type: choice
options:
- none
- dev
- prod
- both
permissions:
id-token: write
contents: read
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test
- run: npm run build
- run: npm run cdk:synth
deploy-dev:
needs: ci
if: ${{ needs.ci.result == 'success' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && (inputs.deploy_target == 'dev' || inputs.deploy_target == 'both'))) }}
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- run: npx cdk deploy TrustedLearningContextServiceStack-dev --require-approval never --context stage=dev
deploy-prod:
needs: ci
if: ${{ needs.ci.result == 'success' && ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch' && (inputs.deploy_target == 'prod' || inputs.deploy_target == 'both'))) }}
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- run: npx cdk deploy TrustedLearningContextServiceStack-prod --require-approval never --context stage=prod