Skip to content

Commit f090d33

Browse files
Merge pull request #3001 from davidgamero/ci/docs-native-pages-deploy
Ci/docs native pages deploy
2 parents 4e42bbb + 6838fad commit f090d33

2 files changed

Lines changed: 59 additions & 34 deletions

File tree

‎.github/workflows/deploy-docs.yml‎

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
name: Build and Deploy Docs
1+
name: Deploy Docs
22
on:
33
push:
44
branches:
55
- main
6-
paths:
7-
- 'src/**'
8-
- 'typedoc.json'
9-
- 'package.json'
10-
- 'package-lock.json'
11-
- '.github/workflows/deploy-docs.yml'
6+
# Allow re-publishing on demand, e.g. after a failed deploy or a Pages
7+
# settings change, without pushing an empty commit to main.
8+
workflow_dispatch:
129

1310
permissions: {}
1411

12+
# Allow one concurrent deployment; queue rather than cancel so an in-flight
13+
# Pages deployment is never left half-applied.
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
1518
jobs:
16-
build-and-deploy-docs:
19+
build:
20+
# workflow_dispatch can be triggered from any ref, and the ref chosen is
21+
# what would get published. Only ever publish main. The push trigger is
22+
# already main-only, so this guard applies solely to manual runs.
23+
# `deploy` needs `build`, so skipping here skips the whole workflow.
24+
if: github.ref == 'refs/heads/main'
1725
runs-on: ubuntu-latest
1826
permissions:
19-
contents: write
27+
contents: read
2028
steps:
2129
- name: Checkout
2230
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -26,17 +34,31 @@ jobs:
2634
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
2735
with:
2836
node-version: '22'
29-
# Pre-check to validate that versions match between package.json
30-
# and package-lock.json. Needs to run before npm install
31-
- name: Validate package.json and package-lock.json versions
32-
run: node version-check.js
33-
- name: Install dependencies
37+
# Root deps are required: docusaurus-plugin-typedoc reads ../src/*.ts
38+
# and needs the root dependency types to resolve.
39+
- name: Install root dependencies
40+
run: npm ci
41+
- name: Install docs dependencies
3442
run: npm ci
43+
working-directory: docs
3544
- name: Build docs
36-
run: npm run docs
37-
38-
- name: Deploy docs
39-
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
45+
run: npm run build
46+
working-directory: docs
47+
- name: Upload Pages artifact
48+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
4049
with:
41-
branch: gh-pages # The branch the action should deploy to.
42-
folder: docs # The folder the action should deploy.
50+
path: docs/build
51+
52+
deploy:
53+
needs: build
54+
runs-on: ubuntu-latest
55+
permissions:
56+
pages: write
57+
id-token: write
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
name: Build and Deploy Docs v2
1+
name: Docs Build and Test
22
on:
3-
push:
4-
branches:
5-
- main
63
pull_request:
74
branches:
85
- main
9-
permissions:
10-
contents: write
6+
7+
permissions: {}
8+
9+
# Stale runs for a PR are worthless once a new commit lands.
10+
concurrency:
11+
group: docs-build-${{ github.ref }}
12+
cancel-in-progress: true
13+
1114
jobs:
12-
build-and-deploy-docs:
15+
build:
1316
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
1419
steps:
1520
- name: Checkout
1621
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22+
with:
23+
persist-credentials: false
1724
- name: Setup Node.js
1825
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
1926
with:
20-
node-version: '20'
27+
node-version: '22'
28+
# Root deps are required: docusaurus-plugin-typedoc reads ../src/*.ts
29+
# and needs the root dependency types to resolve.
2130
- name: Install root dependencies
2231
run: npm ci
2332
- name: Install docs dependencies
@@ -36,9 +45,3 @@ jobs:
3645
mkdir -p _linkcheck/javascript
3746
cp -R docs/build/. _linkcheck/javascript/
3847
npx @untitaker/hyperlink _linkcheck --check-anchors
39-
- name: Deploy to gh-pages
40-
if: github.event_name == 'push'
41-
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
42-
with:
43-
branch: gh-pages
44-
folder: docs/build

0 commit comments

Comments
 (0)