-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (68 loc) · 2.23 KB
/
deploy-dev.yml
File metadata and controls
85 lines (68 loc) · 2.23 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
78
79
80
81
82
83
84
85
name: Deploy to DEV
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
cache: 'npm'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5.1.1
with:
role-to-assume: ${{ vars.AWS_ROLE_ARN_DEV }}
aws-region: ${{ vars.AWS_REGION }}
role-session-name: deploy-dev-lambda-starter
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Run tests
run: npm run test
- name: Install infrastructure dependencies
working-directory: ./infrastructure
run: npm ci
- name: Create infrastructure .env file
working-directory: ./infrastructure
run: echo "${{ vars.CDK_ENV_DEV }}" > .env
- name: Build infrastructure
working-directory: ./infrastructure
run: npm run build
- name: Bootstrap CDK (if needed)
working-directory: ./infrastructure
run: |
# Check if bootstrap is needed
if ! aws cloudformation describe-stacks --stack-name CDKToolkit --region ${{ vars.AWS_REGION }} >/dev/null 2>&1; then
echo "Bootstrapping CDK..."
npm run bootstrap
else
echo "CDK already bootstrapped"
fi
- name: Synthesize CDK stacks
working-directory: ./infrastructure
run: npm run synth
- name: Deploy CDK stacks
working-directory: ./infrastructure
run: npm run deploy:all -- --require-approval never --progress events
# Final Step: Clean up sensitive infrastructure files
- name: Clean up sensitive files
if: always()
working-directory: ./infrastructure
run: |
echo "🧹 Cleaning up sensitive files..."
rm -f .env
rm -rf cdk.out
echo "✅ Sensitive files cleaned up"