-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathaction.yml
More file actions
42 lines (37 loc) · 1.37 KB
/
action.yml
File metadata and controls
42 lines (37 loc) · 1.37 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
name: Request Lambda functions to use new image
inputs:
aws-role-to-assume:
required: true
aws-role-session-name:
required: true
aws-region:
required: true
lambda-name:
required: true
image-tag:
required: true
runs:
using: "composite"
steps:
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
role-to-assume: ${{ inputs.aws-role-to-assume }}
role-session-name: ${{ inputs.aws-role-session-name }}
aws-region: ${{ inputs.aws-region }}
- name: Login to Staging Amazon ECR
id: login-ecr-staging
uses: aws-actions/amazon-ecr-login@261fc3d4806db1fa66a15cc11113c456db8870a7 # v2.1.0
- name: Update Lambda function image
env:
LAMBDA_NAME: ${{ inputs.lambda-name }}
IMAGE_TAG: ${{ inputs.image-tag }}
ECR_REGISTRY: ${{ steps.login-ecr-staging.outputs.registry }}
run: |
functionName=$([ "$LAMBDA_NAME" == "submission" ] && echo "Submission" || echo "$LAMBDA_NAME")
aws lambda update-function-code --function-name $functionName --image-uri $ECR_REGISTRY/$LAMBDA_NAME-lambda:$IMAGE_TAG > /dev/null 2>&1
shell: bash
- name: Logout of Staging Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr-staging.outputs.registry }}
shell: bash