-
-
Notifications
You must be signed in to change notification settings - Fork 3k
97 lines (92 loc) · 3.19 KB
/
build-and-deploy-docs.yml
File metadata and controls
97 lines (92 loc) · 3.19 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
# Workflow for building and deploying the VitePress site to GitHub Pages.
# Build runs on every push to develop and on every PR that touches docs (so
# a build regression is caught at review time instead of breaking develop
# after merge — see #7640). Deploy runs only on push: the github-pages
# environment has protection rules that reject PR refs, and a PR build
# never produced an artifact to deploy anyway.
name: Deploy Docs to GitHub Pages
on:
push:
branches: ["develop"]
paths:
- doc/**
- .github/workflows/build-and-deploy-docs.yml
pull_request:
paths:
- doc/**
- .github/workflows/build-and-deploy-docs.yml
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
packages: read
# Allow only one concurrent deployment, skipping runs queued between the run
# in-progress and latest queued. Do NOT cancel in-progress runs — production
# deployments are allowed to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/cache@v5
name: Cache pnpm store
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: actions/cache@v5
name: Cache vitepress build
with:
path: doc/.vitepress/cache
key: ${{ runner.os }}-vitepress-${{ hashFiles('doc/**/*.md', 'doc/.vitepress/config.*') }}
restore-keys: |
${{ runner.os }}-vitepress-
- uses: pnpm/action-setup@v6
name: Install pnpm
with:
run_install: false
# Pin Node so the build does not silently fall back to whatever the
# runner image ships with. vite 8 requires Node ^20.19.0 || >=22.12.0;
# the repo declares engines.node >=22.12.0 to match.
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- name: Setup Pages
if: github.event_name == 'push'
uses: actions/configure-pages@v6
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build app
working-directory: doc
run: pnpm run docs:build
env:
GITHUB_PAGES: ${{ github.event_name == 'push' && 'true' || '' }}
COMMIT_REF: ${{ github.sha }}
- name: Upload artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v5
with:
path: './doc/.vitepress/dist'
# Deploy to GitHub Pages on push to develop only. Kept as a separate job
# because the github-pages environment's protection rules reject any
# non-develop ref (including PR merge refs), which used to fail the entire
# workflow at job-creation time before any build step could run.
deploy:
needs: build
if: github.event_name == 'push'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5