Repository navigation
90 lines (78 loc) · 2.87 KB
/
Copy pathdeploy.yml
File metadata and controls
90 lines (78 loc) · 2.87 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Build the viewer and publish it to GitHub Pages.
#
# The data is deliberately NOT in this repository. archive/ is several GB of
# derived binary (current sizes: README, "Deploying") that regenerates from prep/*.py, and committing it would turn a
# 1 MB repo into a permanent multi-hundred-MB one -- binary does not delta
# compress, so every regeneration would add a whole fresh copy to history with
# no way back short of a rewrite.
#
# Instead the packed archive lives as a release asset (see README, "Deploying"),
# and this workflow pulls it in at build time. The Pages artifact carries the
# bytes to Pages storage without them ever entering git history, so code can
# deploy as often as it likes while the data is uploaded once.
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Never let two deploys race; drop superseded ones rather than queueing them.
concurrency:
group: pages
cancel-in-progress: true
env:
# Bump when the data changes, and upload a new asset under the new tag.
DATA_RELEASE: data-v23
DATA_ASSET: archive-deploy.tar.gz
jobs:
build:
runs-on: ubuntu-latest
steps:
# viewer/src/tomography/boundaries.ts imports the vendored petrify library
# directly, so the build fails without it. petrify (github.com/siwill22/petrify)
# is public, so the built-in submodule fetch below needs no deploy key --
# that workaround only existed while the submodule pointed at a private repo.
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sanity-check the vendored library
run: test -f viewer/vendor/petrify/js/index.js
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: viewer/package-lock.json
- name: Fetch the packed archive
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p archive
gh release download "$DATA_RELEASE" \
--repo "$GITHUB_REPOSITORY" \
--pattern "$DATA_ASSET" --output - \
| tar -xz -C archive
# viewer/public/archive is a symlink to this directory; if the
# tarball's shape is wrong the build silently ships an empty site.
test -f archive/archive.json
- run: npm ci
working-directory: viewer
- run: npm run build
working-directory: viewer
env:
# A project site is served from /<repo>/, not the domain root.
VITE_BASE: /${{ github.event.repository.name }}/
- uses: actions/upload-pages-artifact@v3
with:
path: viewer/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4