Bump the dependencies group with 1 update (#131) #349
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- 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 |