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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Publishes the visualizer (`vis/`), the explorer and the post, to GitHub
# Pages at https://bbtree.xiangpeng.systems on every push to main, which is
# every merged pull request, and on demand.
#
# One-time setup, outside this file:
# - Settings → Pages → Source: "GitHub Actions".
# - Settings → Pages → Custom domain: bbtree.xiangpeng.systems (an Actions
# deploy ignores a CNAME file), then "Enforce HTTPS" once the certificate
# is issued.
# - DNS: a CNAME record from bbtree.xiangpeng.systems to
# xiangpenghao.github.io.
name: pages
on:
push:
branches:
workflow_dispatch:
# One deploy at a time, and none cancelled halfway: a later push waits.
concurrency:
group: pages
cancel-in-progress: false
permissions:
contents: read
jobs:
build:
name: build the visualizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# The flake's dev shell has the toolchain the README builds with: the
# pinned nightly with wasm32, and the nixpkgs `dx`, which wraps the
# wasm-bindgen-cli that vis/Cargo.toml pins.
- uses: cachix/install-nix-action@v31
- name: Build
run: nix develop --command bash -c 'cd vis && dx build --release --debug-symbols false'
# The post is served at /post/ from its own copy of the page, and any
# other path falls back to it, as the README's static hosting does.
- name: Lay out the site
run: |
site=vis/target/dx/bbtree-vis/release/web/public
mkdir -p "$site/post"
cp "$site/index.html" "$site/post/index.html"
cp "$site/index.html" "$site/404.html"
- uses: actions/upload-pages-artifact@v3
with:
path: vis/target/dx/bbtree-vis/release/web/public
deploy:
name: deploy
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4