1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Playground
# The playground is a static page: the compiler is the same Rust crate the CLI
# uses, built to WebAssembly, so there is no server to deploy.
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Never cancel a deployment mid-flight; queue the next one behind it.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: taiki-e/install-action@v2
with:
tool: wasm-pack
- run: wasm-pack test --node playground
- run: wasm-pack build playground --target web --out-dir www/pkg --no-typescript
# No `configure-pages` step: the page uses only relative paths, and that
# action fails outright while Pages is still disabled on the repository.
- uses: actions/upload-pages-artifact@v4
with:
path: playground/www
deploy:
needs: build
# Publishing is deliberately gated the same way releases are, so a private
# repository does not get a public page before its maintainer asks for one.
if: github.repository_owner == 'inmzhang' && vars.ENABLE_PLAYGROUND == 'true'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- id: deploy
uses: actions/deploy-pages@v4