Build and deploy lambda to AWS #32
This file contains hidden or 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: Build and deploy lambda to AWS | |
on: | |
workflow_dispatch: | |
inputs: | |
runtime: | |
type: choice | |
description: 'What runtime to use?' | |
required: true | |
default: 'graalvm' | |
options: | |
- 'graalvm' | |
- 'pure java' | |
- 'java with snapstart' | |
# push: | |
# branches: [main] | |
# paths: | |
# - '.github/workflows/buildAndDeployLambda.yaml' | |
# - 'scripts/deployLambda.sc' | |
# - '!**.test.scala' | |
# - '**.scala' | |
env: | |
AWS_CLIENT_DEBUG_MODE: ON | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: write # This is required for actions/checkout | |
jobs: | |
buildAndDeployLambda: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: coursier/cache-action@v6 | |
- uses: VirtusLab/scala-cli-setup@main | |
with: | |
jvm: adoptium:1.21 | |
apps: scala scala-cli sbtn | |
power: true | |
- name: Configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::047719648492:role/GithubActionRole | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: eu-central-1 | |
unset-current-credentials: true | |
- name: Show changelog | |
run: echo "CHANGELOG=$(git log --pretty='%h %al %B' ${{ github.event.before }}..${{ github.sha }})" | tr -d "\n\r\'" | cut -c -256 >> "$GITHUB_ENV" | |
- name: Run the script (graalvm) | |
if: ${{ github.event_name == 'push' || inputs.runtime == 'graalvm' }} | |
run: ./scripts/buildAndDeployLambdaNativePackage.sh 64m '${{ env.CHANGELOG }}' | |
shell: bash | |
- name: Run the script (pure java) | |
if: ${{ inputs.runtime == 'pure java' }} | |
run: ./scripts/buildAndDeployLambdaAssembly.sh '${{ env.CHANGELOG }}' 'pure' | |
shell: bash | |
- name: Run the script (java with snapstart) | |
if: ${{ inputs.runtime == 'java with snapstart' }} | |
run: ./scripts/buildAndDeployLambdaAssembly.sh '${{ env.CHANGELOG }}' 'snapstart' | |
shell: bash | |