Repository navigation
90 lines (83 loc) · 3.2 KB
/
Copy pathdocs.yml
File metadata and controls
90 lines (83 loc) · 3.2 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
name: Deploy docs
# Deploys the Nextra consumer site (website/) to GitHub Pages as a static
# export. Bucket A of the docs split (#144); contributor docs stay in-repo and
# are NOT published here.
#
# One-time manual step: repo Settings → Pages → Source = "GitHub Actions".
# The workflow cannot flip that switch.
on:
push:
branches: [main]
paths:
- 'website/**'
- '.github/workflows/docs.yml'
# A rebuild every 6 hours refreshes the Roadmap snapshot (data/roadmap.json) that
# visitors without JavaScript, and search indexing, see.
schedule:
- cron: '17 */6 * * *'
workflow_dispatch:
# Least privilege (#757): the workflow default is read-only. Only the deploy job
# gets `pages: write` and the OIDC token deploy-pages needs to publish; the
# build job, which runs third-party npm code, never holds either.
permissions:
contents: read
# Serialize publishes; never cancel a deploy that is mid-flight.
concurrency:
group: pages
cancel-in-progress: false
defaults:
run:
working-directory: website
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
# Scheduled runs start from the default branch (develop) and a manual run
# starts from whatever branch the dispatcher picked; always build main so
# unreleased docs can never be published (#771).
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
ref: main
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
cache-dependency-path: website/package-lock.json
- run: npm ci
- name: Build static export (served from the docs.donkey-kit.dev root)
run: npm run build
env:
GITHUB_TOKEN: ${{ github.token }}
# Public Cloudflare Web Analytics site token (repository variable);
# unset means the build ships no beacon.
NEXT_PUBLIC_CF_WEB_ANALYTICS_TOKEN: ${{ vars.CF_WEB_ANALYTICS_TOKEN }}
- name: Disable Jekyll so Pages serves Next's _next/ directory
run: touch out/.nojekyll
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: website/out
deploy:
needs: build
# Belt and braces: only main pushes and the scheduled rebuild may publish.
# Schedule runs report github.ref = default branch, hence the event check.
# A manual dispatch from any branch (e.g. develop) builds but never deploys.
if: github.ref == 'refs/heads/main' || github.event_name == 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# configure-pages reads the Pages site config, so it runs here, next to
# the deploy, rather than in the unprivileged build job.
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1