Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Docs Preview

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write # to push to gh-pages branch

concurrency:
group: gh-pages-write
cancel-in-progress: false

jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: pnpm/action-setup@v4
with:
version: 10
- run: pnpm install
- run: pnpm run docs

- name: Deploy preview to gh-pages /preview
uses: peaceiris/actions-gh-pages@v4
with:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude says because it doesn't have keep_files: true this workflow might clear production docs. May you check this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it needs it here because it uses destination_dir so will only clear files at that directory: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-allow-empty-commits-allow_empty_commit

So I need keep_files: false to clear the preview page, but keep_files: true on the root level to stop it wiping the preview

github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
destination_dir: preview
commit_message: "Deploy preview from ${{ github.sha }}"
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jobs:
- run: pnpm format
- run: pnpm build
- run: pnpm test
- run: pnpm run docs
16 changes: 15 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ on:
- "*"

permissions:
id-token: write
contents: write # to push to gh-pages branch
id-token: write # to authenticate with OIDC when publishing to npm

concurrency:
group: gh-pages-write
cancel-in-progress: false

jobs:
publish:
Expand All @@ -23,3 +28,12 @@ jobs:
version: 10
- run: pnpm install
- run: pnpm publish --no-git-checks
- run: pnpm run docs

- name: Deploy released docs to gh-pages root
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
keep_files: true
commit_message: "Deploy released docs ${{ github.ref_name }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
docs
.npmrc
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"format": "prettier --check .",
"build": "tsc",
"test": "jest",
"docs": "typedoc --plugin typedoc-plugin-extras --out docs/ src/index.ts",
"prepack": "pnpm build"
},
"repository": {
Expand All @@ -37,6 +38,8 @@
"jest": "^30.0.4",
"prettier": "^3.6.2",
"ts-jest": "^29.4.0",
"typedoc": "^0.28.15",
"typedoc-plugin-extras": "^4.0.1",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1"
}
Expand Down
Loading
Loading