File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name: Deploy Docs
33on :
44 push :
55 branches : ["main"]
6+ workflow_dispatch : {}
67
78# Branch-based Pages deployment via `docusaurus deploy`
89permissions :
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]"
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ const themeConfig: ThemeConfig = {
1717
1818const 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
You canāt perform that action at this time.
0 commit comments