|
1 | | -name: Deploy Docs |
| 1 | +name: Node CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: ["main"] |
| 5 | + branches: |
| 6 | + - main |
6 | 7 | workflow_dispatch: {} |
7 | 8 |
|
8 | | -# Branch-based Pages deployment via `docusaurus deploy` |
9 | 9 | permissions: |
10 | 10 | contents: write |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - deploy: |
| 13 | + build: |
14 | 14 | 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 }} |
15 | 21 | steps: |
16 | 22 | - uses: actions/checkout@v4 |
17 | 23 | with: |
18 | | - # Required to push to gh-pages |
19 | 24 | 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" |
24 | 25 | - uses: pnpm/action-setup@v3 |
25 | 26 | with: |
26 | 27 | version: 10 |
27 | | - - uses: actions/setup-node@v4 |
| 28 | + - name: SETUP_NODE_${{ matrix.node-version }} |
| 29 | + uses: actions/setup-node@v4 |
28 | 30 | 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 |
35 | 34 | 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 |
53 | 42 | run: pnpm --filter "@gracefullight/docusaurus-plugin-docs" run deploy |
0 commit comments