name: Deploy WASM showcase
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
deploy:
name: Build and deploy
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('Cargo.toml', 'Cargo.toml.orig', 'flake.nix', 'flake.lock', 'web/index.html', '.github/workflows/deploy-worker.yml') }}
restore-keys: |
${{ runner.os }}-cargo-wasm-
- name: Build WASM showcase
env:
NO_COLOR: false
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
CARGO_PROFILE_RELEASE_DEBUG: "0"
CARGO_PROFILE_RELEASE_LTO: fat
CARGO_PROFILE_RELEASE_OPT_LEVEL: z
CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS: "false"
CARGO_PROFILE_RELEASE_PANIC: abort
run: nix develop -c trunk build web/index.html --release --dist dist --public-url /
- name: Deploy Worker
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: nix develop -c npx --yes wrangler@4.106.0 deploy