-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
60 lines (54 loc) · 1.64 KB
/
action.yml
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
name: deploy-backend
description: Deploys backend artifact to AWS.
inputs:
artifact-path:
default: artifacts/backend/lambda.zip
required: false
type: string
aws-resource-name:
required: true
type: string
aws-cloudfront-id:
required: true
type: string
runs:
using: composite
steps:
- name: upload artifact
shell: bash
run: >
aws s3 cp
${{ inputs.artifact-path }}
s3://codeforpoznan-lambdas/${{ inputs.aws-resource-name }}_serverless_api.zip
- name: refresh lambda
shell: bash
run: >
aws lambda update-function-code
--s3-bucket codeforpoznan-lambdas
--s3-key ${{ inputs.aws-resource-name }}_serverless_api.zip
--function-name ${{ inputs.aws-resource-name }}_serverless_api
| jq 'del(.Environment, .VpcConfig, .Role, .FunctionArn)'
- name: refresh lambda (migration)
shell: bash
run: >
aws lambda update-function-code
--s3-bucket codeforpoznan-lambdas
--s3-key ${{ inputs.aws-resource-name }}_migration.zip
--function-name ${{ inputs.aws-resource-name }}_migration
| jq 'del(.Environment, .VpcConfig, .Role, .FunctionArn)'
- name: run migration
shell: bash
run: >
aws lambda invoke
--function-name ${{ inputs.aws-resource-name }}_migration
response.json > request.json
- name: show migration output
shell: bash
run: >
jq -s add ./*.json | jq -re '
if .FunctionError then
.FunctionError, .errorMessage, false
else
.stdout, .stderr
end
'