Skip to content

Commit efcb4d9

Browse files
committed
fix: 🐛 refactor GitHub Actions workflow for Docusaurus deployment and streamline node setup
1 parent 6fb63cc commit efcb4d9

1 file changed

Lines changed: 22 additions & 33 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,42 @@
1-
name: Deploy Docs
1+
name: Node CI
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches:
6+
- main
67
workflow_dispatch: {}
78

8-
# Branch-based Pages deployment via `docusaurus deploy`
99
permissions:
1010
contents: write
1111

1212
jobs:
13-
deploy:
13+
build:
1414
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
node-version: [22.x]
18+
env:
19+
GIT_USER: github-actions[bot]
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1521
steps:
1622
- uses: actions/checkout@v4
1723
with:
18-
# Required to push to gh-pages
1924
fetch-depth: 0
20-
- name: Configure git identity
21-
run: |
22-
git config user.name "github-actions[bot]"
23-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
2425
- uses: pnpm/action-setup@v3
2526
with:
2627
version: 10
27-
- uses: actions/setup-node@v4
28+
- name: SETUP_NODE_${{ matrix.node-version }}
29+
uses: actions/setup-node@v4
2830
with:
29-
node-version: 22
30-
cache: "pnpm"
31-
- run: pnpm install --frozen-lockfile
32-
- name: Ensure gh-pages branch exists
33-
env:
34-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
node-version: ${{ matrix.node-version }}
32+
cache: pnpm
33+
- name: BEFORE_SCRIPT
3534
run: |
36-
set -e
37-
if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then
38-
echo "gh-pages branch exists"
39-
else
40-
echo "Initializing gh-pages branch"
41-
git switch --orphan gh-pages
42-
git rm -rf . || true
43-
echo '<!doctype html><meta charset="utf-8"><meta http-equiv="refresh" content="0; url=/docusaurus-plugins/">' > index.html
44-
git add index.html
45-
git commit -m "chore: initialize gh-pages"
46-
git push origin gh-pages
47-
git switch -
48-
fi
49-
- name: Deploy with Docusaurus
50-
env:
51-
GIT_USER: github-actions[bot]
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
git config user.name "github-actions[bot]"
36+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37+
- name: INSTALL_PACKAGES
38+
run: pnpm install --frozen-lockfile
39+
- name: BUILD
40+
run: pnpm --filter "@gracefullight/docusaurus-plugin-docs" run build
41+
- name: DEPLOY
5342
run: pnpm --filter "@gracefullight/docusaurus-plugin-docs" run deploy

0 commit comments

Comments
 (0)