Skip to content

Commit 25e2fbe

Browse files
committed
chore: rework docs deploy workflow
1 parent 94aeadb commit 25e2fbe

File tree

2 files changed

+87
-13
lines changed

2 files changed

+87
-13
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# Review gh actions docs if you want to further define triggers, paths, etc
8+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
9+
10+
# Ensure we avoid any race conditions with rapid pushes to main
11+
concurrency:
12+
group: "Deploy to GitHub Pages"
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build:
20+
name: Build Docusaurus
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
persist-credentials: false
26+
fetch-depth: 0
27+
- name: Use Node.js
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version-file: ".node-version"
31+
- name: restore node_modules
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
packages/node_modules
36+
key: ${{ runner.os }}-${{ hashFiles('packages/yarn.lock') }}
37+
- name: Prepare Environment
38+
run: |
39+
corepack enable
40+
41+
cd packages
42+
yarn config set cacheFolder /home/runner/publish-docs-cache
43+
yarn install
44+
yarn build:all
45+
env:
46+
CI: true
47+
- name: Run docusaurus
48+
run: |
49+
cd packages/documentation
50+
yarn docs:build
51+
env:
52+
CI: true
53+
- name: Run typedoc
54+
run: |
55+
cd packages
56+
yarn docs:typedoc
57+
cp docs documentation/build/typedoc -R
58+
env:
59+
CI: true
60+
61+
- name: Upload Build Artifact
62+
uses: actions/upload-pages-artifact@v4
63+
with:
64+
path: packages/documentation/build
65+
66+
deploy:
67+
name: Deploy to GitHub Pages
68+
needs: build
69+
70+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
71+
permissions:
72+
pages: write # to deploy to Pages
73+
id-token: write # to verify the deployment originates from an appropriate source
74+
75+
# Deploy to the github-pages environment
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Deploy to GitHub Pages
83+
id: deployment
84+
uses: actions/deploy-pages@v4

.github/workflows/node.yaml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,12 @@ jobs:
625625
env:
626626
CI: true
627627

628-
publish-docs:
629-
name: Publish Docs
628+
build-docs:
629+
name: Build Docs
630630
runs-on: ubuntu-latest
631-
continue-on-error: true
632631
timeout-minutes: 15
633632

634-
permissions:
635-
contents: write
636-
633+
# This is just to ensure the docs build, another job performs the build & publish
637634
steps:
638635
- uses: actions/checkout@v6
639636
with:
@@ -671,13 +668,6 @@ jobs:
671668
cp docs documentation/build/typedoc -R
672669
env:
673670
CI: true
674-
- name: Publish
675-
if: github.ref == 'refs/heads/main' # always publish for just the main branch
676-
uses: peaceiris/actions-gh-pages@v4
677-
with:
678-
github_token: ${{ secrets.GITHUB_TOKEN }}
679-
publish_dir: ./packages/documentation/build
680-
force_orphan: true
681671

682672
check-for-multiple-library-versions:
683673
name: Check for multiple library versions

0 commit comments

Comments
 (0)