-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (58 loc) · 1.95 KB
/
Copy pathlambda-shared-deploy.yaml
File metadata and controls
58 lines (58 loc) · 1.95 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
---
name: 'Shared CD flow'
on:
workflow_call:
inputs:
deploy_to_environment:
type: string
description: Name of GH environment which image be deployed to
required: false
default: ''
lambda:
required: true
type: string
description: 'Lambda Name'
docker_image_version:
required: false
type: string
default: latest
description: Used as version for ECR Docker image
secrets:
aws_account_id:
required: true
aws_role_id:
required: true
description: Role used for authenticating this run with AWS
aws_region:
required: true
description: AWS ECR Region
aws_ecr_repository:
required: true
description: AWS ECR Repository name
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.deploy_to_environment }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js Current
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.aws_account_id }}:role/${{ secrets.aws_role_id }}
role-session-name: ${{ secrets.aws_role_id }}
aws-region: ${{ secrets.aws_region }}
- name: Deploy Lambda
run: |
aws lambda update-function-code --cli-connect-timeout 15000 --region $AWS_REGION --function-name $LAMBDA --image $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_ECR_REPOSITORY:$DOCKER_IMAGE_VERSION
env:
LAMBDA: ${{ inputs.lambda }}
AWS_REGION: ${{ secrets.aws_region }}
AWS_ACCOUNT_ID: ${{ secrets.aws_account_id }}
AWS_ECR_REPOSITORY: ${{ secrets.aws_ecr_repository }}
DOCKER_IMAGE_VERSION: ${{ inputs.docker_image_version }}
BUILDX_NO_DEFAULT_ATTESTATIONS: 1