Release #3
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: Release | |
on: | |
workflow_dispatch: {} | |
release: | |
types: [created] | |
env: | |
AWS_REGION: eu-west-1 | |
SAR_ARTIFACT_BUCKET: ${{ secrets.SAR_ARTIFACT_BUCKET }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
- uses: aws-actions/setup-sam@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_REPO_ROLE_ARN }} | |
aws-region: eu-west-1 | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Install zig | |
uses: goto-bus-stop/setup-zig@v2 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.cargo/bin | |
target | |
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install cargo lambda | |
run: | | |
if [ ! -f ~/.cargo/bin/cargo-lambda ] | |
then | |
cargo install --locked cargo-lambda | |
else | |
echo "Cargo Lambda already installed" | |
fi | |
- name: Sam build | |
run: | | |
sam build | |
sam package --output-template-file .aws-sam/packaged.yml --s3-bucket ${{ secrets.SAR_ARTIFACT_BUCKET }} | |
- name: Compress bootstrap | |
working-directory: .aws-sam/build/OidcAuthorizer | |
run: | | |
zip -9 bootstrap.zip bootstrap | |
- name: Upload bootstrap.zip to GitHub release | |
uses: xresloader/upload-to-github-release@v1 | |
if: github.event.release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: ".aws-sam/build/OidcAuthorizer/bootstrap.zip" | |
tags: true | |
draft: true | |
- name: Sam publish to SAR | |
run: sam publish --template .aws-sam/packaged.yml --region eu-west-1 |