Skip to content

Commit 808ef77

Browse files
committed
chore(ci): update GitHub Pages workflow for improved deployment
- Changed permissions to read for contents and added write permissions for pages and id-token. - Refactored job structure to simplify deployment steps and added concurrency settings. - Updated Node.js setup to use the latest LTS version and modified deployment steps to include CNAME configuration and artifact upload. - Replaced the previous deployment action with the new actions/deploy-pages for streamlined GitHub Pages deployment.
1 parent 3d8861c commit 808ef77

1 file changed

Lines changed: 29 additions & 16 deletions

File tree

.github/workflows/gh-pages.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ on:
99
- ".github/workflows/gh-pages.yml"
1010

1111
permissions:
12-
contents: write
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: true
1319

1420
jobs:
15-
build:
16-
runs-on: ${{ matrix.os }}
21+
deploy:
22+
runs-on: ubuntu-latest
1723

18-
strategy:
19-
matrix:
20-
node-version: [lts/*]
21-
os: [ubuntu-latest]
22-
fail-fast: false
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
2327

2428
steps:
2529
- uses: actions/checkout@v6
@@ -29,10 +33,10 @@ jobs:
2933
with:
3034
version: 10
3135

32-
- name: Use Node.js ${{ matrix.node-version }}
36+
- name: Use Node.js
3337
uses: actions/setup-node@v6
3438
with:
35-
node-version: ${{ matrix.node-version }}
39+
node-version: lts/*
3640
cache: pnpm
3741
cache-dependency-path: docs/pnpm-lock.yaml
3842

@@ -44,10 +48,19 @@ jobs:
4448
working-directory: docs
4549
run: pnpm build
4650

47-
- name: 🪤 Deploy to GitHub Pages
48-
uses: peaceiris/actions-gh-pages@v4
51+
- name: 🏷️ Write CNAME
52+
working-directory: docs
53+
run: |
54+
echo "sts2-ritsulib.ritsukage.com" > dist/CNAME
55+
56+
- name: ⚙️ Configure Pages
57+
uses: actions/configure-pages@v5
58+
59+
- name: ⬆️ Upload Pages artifact
60+
uses: actions/upload-pages-artifact@v3
4961
with:
50-
github_token: ${{ secrets.GITHUB_TOKEN }}
51-
publish_dir: ./docs/dist
52-
cname: sts2-ritsulib.ritsukage.com
53-
force_orphan: true
62+
path: docs/dist
63+
64+
- name: 🚀 Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)