Skip to content

Commit b713486

Browse files
committed
fix: šŸ› add gh-pages branch initialization and update Docusaurus config for deployment
1 parent 9496827 commit b713486

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

ā€Ž.github/workflows/deploy-docs.ymlā€Ž

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Deploy Docs
33
on:
44
push:
55
branches: ["main"]
6+
workflow_dispatch: {}
67

78
# Branch-based Pages deployment via `docusaurus deploy`
89
permissions:
@@ -24,6 +25,23 @@ jobs:
2425
node-version: 22
2526
cache: "pnpm"
2627
- run: pnpm install --frozen-lockfile
28+
- name: Ensure gh-pages branch exists
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: |
32+
set -e
33+
if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then
34+
echo "gh-pages branch exists"
35+
else
36+
echo "Initializing gh-pages branch"
37+
git switch --orphan gh-pages
38+
git rm -rf . || true
39+
echo '<!doctype html><meta charset="utf-8"><meta http-equiv="refresh" content="0; url=/docusaurus-plugins/">' > index.html
40+
git add -A
41+
git commit -m "chore: initialize gh-pages"
42+
git push origin gh-pages
43+
git switch -
44+
fi
2745
- name: Configure git identity
2846
run: |
2947
git config user.name "github-actions[bot]"

ā€Žapps/docs/docusaurus.config.tsā€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const themeConfig: ThemeConfig = {
1717

1818
const config: Config = {
1919
baseUrl: "/docusaurus-plugins/",
20+
// Ensure branch-based GH Pages deploys target the right branch
21+
deploymentBranch: "gh-pages",
2022
favicon: "img/favicon.ico",
2123
onBrokenLinks: "throw",
2224
onBrokenMarkdownLinks: "warn",
@@ -36,6 +38,8 @@ const config: Config = {
3638
projectName: "docusaurus-plugins",
3739
themeConfig,
3840
title: "docusaurus-plugins",
41+
// Set explicit trailingSlash for GitHub Pages to avoid redirect quirks
42+
trailingSlash: true,
3943
url: "https://gracefullight.github.io",
4044
};
4145

0 commit comments

Comments
Ā (0)