-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (49 loc) · 1.52 KB
/
deploy-lambda.yml
File metadata and controls
62 lines (49 loc) · 1.52 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
name: Deploy Lambda Thumbnail Generator
on:
push:
branches:
- main
paths:
- 'thumbnail-microservice/**'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies and create deployment package
run: |
# Install dependencies to a package directory
pip install -r requirements.txt -t package/
# Copy Lambda function code to package
cp src/lambda_function.py package/
# Create deployment zip
cd package
zip -r ../deployment-package.zip .
cd ..
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8
- name: Terraform Init
working-directory: terraform
run: terraform init
- name: Terraform Plan
working-directory: terraform
run: terraform plan
- name: Terraform Apply
working-directory: terraform
run: terraform apply -auto-approve