Frontend #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: Frontend | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-github-pages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup yq" | |
uses: dcarbone/[email protected] | |
- name: "Configure AWS credentials" | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
mask-aws-account-id: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
override: true | |
- name: "Rust Cache" | |
uses: Swatinem/rust-cache@v2 | |
- name: "Download and install Trunk binary" | |
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- | |
- name: "Build" | |
run: | | |
pushd frontend | |
../trunk build --release --public-url "${GITHUB_REPOSITORY#*/}" | |
mv dist ../dist | |
popd | |
- name: "Fetch and Place Reports from AWS S3" | |
run: | | |
parameters_json=$(yq -o=json '.' parameters.yml) | |
bucket_name=$(jq -r '.bucket_name' <<< $parameters_json) | |
mkdir -p dist/assets/reports | |
aws s3 sync s3://$bucket_name/reports/ dist/reports/ | |
- name: "Deploy" | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist | |
single-commit: true |