-
-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (50 loc) · 1.77 KB
/
deploy-all-lambdas.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
name: deploy lambda functions
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push: { branches: [main] }
jobs:
deploy-lambdas:
runs-on: ubuntu-latest
container: swift:5.9-amazonlinux2
env:
AWS_DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER_ACCESS_SECRET_KEY }}
steps:
- name: Install additional dependencies and AWSCLI v2
run: |
echo "::add_mask::$AWS_ACCESS_KEY_ID"
echo "::add_mask::$AWS_SECRET_ACCESS_KEY"
yum -y install \
{libuuid,libicu,libedit,sqlite,python,ncurses,openssl}-devel \
libtool jq zip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
- name: Check out repository
uses: actions/checkout@v3
- name: Build, package, and deploy
run: |
mkdir zips
for name in $(
swift package dump-package | \
jq '.targets' | \
jq 'map(select(.type == "executable"))' | \
jq 'map(select(.path != null))' | \
jq 'map(select(.path | startswith("./Lambdas")))' | \
jq -r '.[].name'
); do
swift package archive \
--output-path ./zips \
--products "${name}"
aws s3api put-object \
--bucket penny-lambdas-store \
--key "${name}.zip" \
--body ./zips/${name}/${name}.zip
aws lambda update-function-code \
--function-name "${name}" \
--s3-bucket "penny-lambdas-store" \
--s3-key "${name}.zip"
done