Skip to content

Commit 7899c27

Browse files
committed
Add GitHub Actions workflow to deploy JSDoc to GitHub
1 parent bd926d7 commit 7899c27

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy JSDoc to GitHub Pages
2+
3+
on:
4+
push:
5+
tags:
6+
- 'docs-*'
7+
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: 'Build docs only (skip deploy to Pages)'
11+
required: true
12+
type: boolean
13+
default: true
14+
15+
concurrency:
16+
group: deploy-docs
17+
cancel-in-progress: false
18+
19+
permissions:
20+
contents: read
21+
pages: write
22+
id-token: write
23+
24+
jobs:
25+
build:
26+
if: github.repository == 'RobotWebTools/rclnodejs'
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0
32+
fetch-tags: true
33+
34+
- name: Fetch gh-pages branch
35+
run: git fetch origin gh-pages:refs/remotes/origin/gh-pages
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v6
39+
with:
40+
node-version: 24.x
41+
42+
- name: Install dependencies
43+
run: npm ci --ignore-scripts
44+
45+
- name: Build docs
46+
run: npm run docs:gh-pages
47+
48+
- name: Upload Pages artifact
49+
uses: actions/upload-pages-artifact@v5
50+
with:
51+
path: build/gh-pages-docs
52+
53+
deploy:
54+
needs: build
55+
if: ${{ !(inputs.dry_run == true) }}
56+
runs-on: ubuntu-latest
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v5

tools/jsdoc/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,31 @@ For a new release such as `1.9.0`:
6565
- `build/gh-pages-docs/.nojekyll`
6666
6. Publish the contents of `build/gh-pages-docs/` to the `gh-pages` branch.
6767

68+
## GitHub Actions Deployment
69+
70+
The `deploy-docs.yml` workflow (`.github/workflows/deploy-docs.yml`) automates
71+
building and deploying docs to GitHub Pages.
72+
73+
### Triggers
74+
75+
- **Tag push** matching `docs-*` (e.g. `git tag docs-1.9.0 && git push origin docs-1.9.0`) — builds and deploys automatically.
76+
- **Manual dispatch** from the Actions tab — includes a `dry_run` toggle
77+
(defaults to `true`). Set it to `false` to deploy.
78+
79+
### What it does
80+
81+
1. Full checkout with all tags and the `origin/gh-pages` branch.
82+
2. Runs `npm run docs:gh-pages` to stage the docs tree.
83+
3. Uploads the staged output as a Pages artifact.
84+
4. Deploys to GitHub Pages (skipped when `dry_run` is `true`).
85+
86+
### Testing
87+
88+
- Run the workflow manually with `dry_run` enabled to verify the build
89+
succeeds without deploying.
90+
- Push a `docs-test` tag to trigger a full build + deploy, then clean up:
91+
`git tag -d docs-test && git push origin :refs/tags/docs-test`.
92+
6893
## Manual Landing Page Rebuild
6994

7095
If the staged docs tree already exists and you only want to rebuild

0 commit comments

Comments
 (0)