Skip to content

Workflow file for this run

name: Deploy GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
cargo install trunk || true \
&& rustup target add wasm32-unknown-unknown
- name: Build the Rust WASM app and all of its assets
run: trunk build --release --public-url /${{ github.event.repository.name }}/
- name: Optimize the Rust WASM app
uses: NiklasEi/wasm-opt-action@v2
with:
file: dist/*.wasm
optimize_all: true
- name: Save cache
uses: actions/cache/save@v4
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./dist"
deploy:
needs: build
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4