Skip to content

Bump the all-dependencies group across 1 directory with 5 updates (#203) #448

Bump the all-dependencies group across 1 directory with 5 updates (#203)

Bump the all-dependencies group across 1 directory with 5 updates (#203) #448

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.10-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: |
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: Find package names
id: find_package_names
run: |
echo "names=$(
swift package describe --type json | \
jq -r '.targets[] |
select(
.type == "executable"
and
(.name | endswith("Lambda"))
).name' | \
tr '\n' ' '
)" >> $GITHUB_OUTPUT
- name: Build and package
run: |
mkdir zips
for name in ${{ steps.find_package_names.outputs.names }}; 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
done
- name: Deploy
run: |
for name in ${{ steps.find_package_names.outputs.names }}; do
aws lambda update-function-code \
--function-name "${name}" \
--s3-bucket "penny-lambdas-store" \
--s3-key "${name}.zip"
done