-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.63 KB
/
Copy pathdocs.yml
File metadata and controls
86 lines (74 loc) · 2.63 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
name: Deploy docs
# Builds docs/site and publishes the generated static files to the gh-pages
# branch. Repository Settings -> Pages should use "Deploy from a branch" with
# branch "gh-pages" and folder "/".
#
# This workflow uses a repository secret named DEPLOY_DOCUMENT_GH_PAGES_KEY.
# The secret must contain an SSH private key whose public key is registered as
# a deploy key with write access to this repository. This avoids the GitHub
# Pages branch-publish limitation where pushes made with GITHUB_TOKEN do not
# trigger a Pages build.
on:
push:
branches:
- main
paths:
- ".github/workflows/docs.yml"
- "docs/site/**"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-docs-gh-pages
cancel-in-progress: false
jobs:
build-and-publish:
name: Build and publish docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
lfs: true
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.20.0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build documentation site
run: pnpm docs:build
- name: Configure gh-pages SSH deploy key
shell: bash
run: |
install -m 700 -d ~/.ssh
printf '%s\n' "${{ secrets.DEPLOY_DOCUMENT_GH_PAGES_KEY }}" > ~/.ssh/deploy_document_gh_pages_key
chmod 600 ~/.ssh/deploy_document_gh_pages_key
ssh-keyscan github.com >> ~/.ssh/known_hosts
cat >> ~/.ssh/config <<'EOF'
Host github.com
IdentityFile ~/.ssh/deploy_document_gh_pages_key
IdentitiesOnly yes
EOF
- name: Publish gh-pages branch
shell: bash
run: |
rm -rf build/gh-pages
mkdir -p build/gh-pages
rsync -a --delete docs/site/dist/ build/gh-pages/
touch build/gh-pages/.nojekyll
git -C build/gh-pages init --initial-branch=gh-pages
git -C build/gh-pages config user.name "github-actions[bot]"
git -C build/gh-pages config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git -C build/gh-pages remote add origin "git@github.com:${{ github.repository }}.git"
git -C build/gh-pages add --all
git -C build/gh-pages commit -m "Deploy docs from ${GITHUB_SHA}"
git -C build/gh-pages push --force origin gh-pages