add GitHub Actions workflow for deploying WebAssembly to GitHub Pages

This commit is contained in:
2025-11-02 01:21:43 +01:00
parent c1344a3553
commit 60b6d57dd3

57
.github/workflows/deploy-pages.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Deploy WebAssembly to GitHub Pages
on:
push:
branches:
- rust
workflow_dispatch: {}
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
name: Build (trunk -> dist)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust (stable + wasm32)
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install trunk
run: cargo install trunk --locked
- name: Build with trunk
working-directory: schafkopf-logic
run: |
trunk build --release --public-url "/${{ github.event.repository.name }}/"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: schafkopf-logic/dist
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4