-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.55 KB
/
lambda_deploy.yaml
File metadata and controls
49 lines (42 loc) · 1.55 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
name: Deploy to Amazon ECR and lambda
on:
push:
branches: ["main"]
# pull_request_target:
# branches: ["main"]
env:
AWS_REGION: us-east-1
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
DOCKERFILE_PATH: Dockerfile
jobs:
deploy:
strategy:
matrix:
LAMBDA_NAME: [lambda1, lambda2, lambda3]
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN_CORP }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CORP }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CORP }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2.0.1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build --target prod --build-arg LAMBDA_NAME=${{matrix.LAMBDA_NAME}} --provenance=false -t $ECR_REGISTRY/${{matrix.LAMBDA_NAME}}:$IMAGE_TAG .
docker push $ECR_REGISTRY/${{matrix.LAMBDA_NAME}}:$IMAGE_TAG
echo "image=$ECR_REGISTRY/${{matrix.LAMBDA_NAME}}:$IMAGE_TAG" >> $GITHUB_OUTPUT