Skip to content

AWS publish artifacts to S3 #4

AWS publish artifacts to S3

AWS publish artifacts to S3 #4

name: AWS publish artifacts to S3
permissions:
id-token: write
contents: read
on:
workflow_dispatch:
inputs:
region:
description: 'region on which you want to deploy'
type: choice
options:
- eu-west-1
- us-east-1
required: true
architecture:
description: 'architecture'
type: choice
options:
- x86_64
- arm64
required: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
runner: ${{ steps.select.outputs.runner }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check branch
id: select
run: |
if [ ${{ inputs.architecture }} == 'x86_64' ]; then
echo "runner=ubuntu-latest" >> $GITHUB_OUTPUT
else
echo "runner=self-hosted" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
- uses: actions/checkout@v3
- name: Build runtime matrix
id: set-matrix
run: |
jq -c '[.runtimes[] | select(.architectures | index("${{ inputs.architecture }}")) | .path]' manifest.json
echo "matrix=$(jq -c '[.runtimes[] | select(.architectures | index("${{ inputs.architecture }}")) | .path]' manifest.json)" >> $GITHUB_OUTPUT
build-upload:
needs: setup
runs-on: ${{ needs.setup.outputs.runner }}
strategy:
matrix:
runtime_id: ${{fromJson(needs.setup.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- name: configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GitHub_Action_LambdaPerf_Session
aws-region: ${{ inputs.region }}
- name: build and deploy
env:
ARCHITECTURE: ${{ inputs.architecture }}
AWS_REGION: ${{ inputs.region }}
RUNTIME_ID: ${{ matrix.runtime_id }}
run: |
cd s3-uploader
yarn install
node app.mjs