-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 3.14 KB
/
deploy-lambda.yml
File metadata and controls
105 lines (91 loc) · 3.14 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Deploy Lambda Functions and Infrastructure
on:
push:
branches:
- main
paths:
- 'lambda/**'
- 'infrastructure/**'
- '.github/workflows/deploy-lambda.yml'
# Allow manual trigger
workflow_dispatch:
env:
CDK_DEFAULT_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }}
CDK_DEFAULT_REGION: us-east-1
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@v1
with:
version: 2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
# Build Lambda functions
- name: Build transcribe Lambda
working-directory: ./lambda/transcribe
run: |
npm install
chmod +x prepare-ffmpeg.sh build.sh
./prepare-ffmpeg.sh
./build.sh
- name: Build analyze-transcript Lambda
working-directory: ./lambda/analyze-transcript
run: |
npm install
npm run build
- name: Build analyze-common-pain-points Lambda
working-directory: ./lambda/analyze-common-pain-points
run: |
npm install
npm run build
# Bootstrap CDK (if not already done)
- name: Bootstrap CDK
working-directory: ./infrastructure/cdk
run: |
npm ci
npx cdk bootstrap aws://${{ env.CDK_DEFAULT_ACCOUNT }}/${{ secrets.AWS_REGION }}
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
# Deploy CDK infrastructure
- name: Deploy CDK infrastructure
working-directory: ./infrastructure/cdk
run: |
npm install -g aws-cdk
npm run build
echo "Starting CDK deployment..."
cdk deploy --require-approval never --verbose || {
echo "CDK deployment failed"
exit 1
}
echo "CDK deployment completed successfully"
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
# Output SQS Queue URLs and save to file
- name: Get SQS Queue URLs
id: get-queue-urls
if: success()
run: |
echo "Getting stack outputs..."
aws cloudformation describe-stacks --stack-name PainpointLambdaStack --query "Stacks[0].Outputs" --output json > queue-outputs.json
echo "Queue URLs have been saved to queue-outputs.json. Add these to your Vercel environment variables."
# Upload queue URLs as artifact
- name: Upload queue URLs
uses: actions/upload-artifact@v4
with:
name: queue-urls
path: queue-outputs.json