AWS publish artifacts to S3 #8
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: 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@v4 | |
- 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@v4 | |
- 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: Delete huge unnecessary folders | |
run: | | |
rm -rf /opt/hostedtoolcache | |
rm -rf /usr/share/dotnet | |
rm -rf /opt/ghc | |
rm -rf "$AGENT_TOOLSDIRECTORY" | |
- 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 |