Repository navigation
103 lines (86 loc) · 3.18 KB
/
Copy pathdeploy.yml
File metadata and controls
103 lines (86 loc) · 3.18 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
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
# Rebuild ~30 min after the daily data refresh so the deployed snapshot stays
# current even though bot pushes don't re-trigger workflows.
schedule:
- cron: "30 13 * * *"
permissions:
contents: read
pages: write
id-token: write
concurrency:
# Latest push wins: cancel an in-progress deploy so rapid pushes don't collide
# on the Pages "one deployment in flight" limit (which fails the newer run).
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
# Best-effort refresh so the deployed site always serves a fresh snapshot.
# Tolerate failure: the committed snapshot in public/data is the fallback.
- name: Refresh data (best-effort)
run: npm run fetch-data || echo "fetch-data failed; using committed snapshot"
- name: Build
run: npm run build
- name: Prerender shell
run: npm run prerender
- name: Generate static pages
run: npm run generate-pages
# Gate: prove the built app actually mounts (home + exact-trip + tour) in a
# headless browser. A build that would render a blank page fails here and
# never deploys.
- name: Verify render (no blank page)
run: npm run verify
# End-to-end user-journey gate: drives real flows (search, mode switch,
# deep links, the staged-edit model, history) against the built app. A
# behavioural regression fails here and never deploys.
- name: End-to-end user journeys
run: npm run test:e2e
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url || steps.deployment-retry.outputs.page_url }}
steps:
# The GitHub Pages API allows only one deployment in flight and rejects a
# new one with a 400 ("in progress deployment") if a prior deploy is still
# settling server-side — separate from the Actions `concurrency` group,
# which only cancels overlapping *runs*. So a deploy can fail purely because
# a previous one hasn't finished settling. Try once, and on failure wait for
# the lock to clear and retry, so the deploy recovers without a manual re-run.
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
timeout: 600000
continue-on-error: true
- name: Wait for the in-flight deployment to settle
if: steps.deployment.outcome == 'failure'
run: sleep 90
- name: Deploy to GitHub Pages (retry)
if: steps.deployment.outcome == 'failure'
id: deployment-retry
uses: actions/deploy-pages@v4
with:
timeout: 600000