0.1.1 #21
Workflow file for this run
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: write | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: | | |
echo "$GITHUB_CONTEXT" | |
- 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 | |
with: | |
version: 0.10.0 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/.cargo/bin | |
target | |
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Cargo Lambda | |
uses: jaxxstorm/action-install-gh-release@v1.9.0 | |
with: | |
repo: cargo-lambda/cargo-lambda | |
platform: linux | |
arch: x86_64 | |
- name: Sam build | |
run: | | |
sam build | |
- name: Compress bootstrap | |
working-directory: .aws-sam/build/OidcAuthorizer | |
run: | | |
zip -9 bootstrap.zip bootstrap | |
- name: Upload bootstrap.zip to (existing) 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" | |
release_id: ${{ github.event.release.id }} | |
- name: Upload bootstrap.zip to (new draft) GitHub release | |
uses: xresloader/upload-to-github-release@v1 | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: ".aws-sam/build/OidcAuthorizer/bootstrap.zip" | |
draft: true | |
default_release_name: "Manual release (test)" | |
- name: Sam publish to SAR | |
if: github.event.release | |
run: | | |
sam package --output-template-file .aws-sam/packaged.yml --s3-bucket ${{ secrets.SAR_ARTIFACT_BUCKET }} | |
sam publish --template .aws-sam/packaged.yml --region eu-west-1 |