-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (49 loc) · 1.43 KB
/
deploy.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
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Check for required secrets
run: |
if [ -z "${{ secrets.AWS_ACCOUNT_ID }}" ]; then
echo "Error: AWS_ACCOUNT_ID secret is not set."
exit 1
fi
if [ -z "${{ secrets.AWS_REGION }}" ]; then
echo "Error: AWS_REGION secret is not set."
exit 1
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GithubActionsCamplyRole
aws-region: ${{ secrets.AWS_REGION }}
- name: Install dependencies
run: |
npm ci
cd lambda && pip install -r requirements.txt -t .
- name: Run tests
run: npm test
- name: Build CDK app
run: npm run build
- name: Deploy to AWS
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npx cdk deploy --require-approval never