Repository navigation
81 lines (69 loc) · 2.55 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
81 lines (69 loc) · 2.55 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
name: Deploy Docs to GitHub Pages
on:
push:
branches: [main]
pull_request_target:
branches: [main]
types: [closed]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
if: github.event_name != 'pull_request_target' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.ref || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build docs
run: npm run docs:build
# The same artifact gate docs-pr-check.yml runs, here as well, because that
# workflow is `pull_request`-only and this one is what actually ships.
# Without this step a direct push to main uploads to Pages with nothing
# checking it, and two individually-green pull requests can combine into a
# broken artifact: each was checked against its own base, neither against
# the merge result. Measured on 92925e5: a one-character typo in the
# config.ts navbar leaves `npm run docs:build` exiting 0 while shipping 424
# dead references across 212 of 213 rendered pages.
#
# No `continue-on-error`, no `|| true`, and deliberately NOT `if: always()`.
# A failed build leaves no artifact, and measuring an absent or stale dist
# is the exact failure this exists to prevent - the script refuses to run
# when dist is missing, so a green result here always means it read the
# bytes this job is about to upload. It runs BEFORE `.nojekyll` and
# `upload-pages-artifact` so a bad artifact is never published at all.
- name: Check the built artifact for dead internal links
run: node scripts/check-dist-links.mjs
- name: Add .nojekyll
run: touch docs/.vuepress/dist/.nojekyll
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/.vuepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5