Skip to content

Commit fd50da6

Browse files
committed
Update: Use official GitHub Pages deployment actions and fix permissions
1 parent 2c201b9 commit fd50da6

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,20 @@ on:
55
branches:
66
- main
77

8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
820
jobs:
9-
build-and-deploy:
21+
build:
1022
runs-on: ubuntu-latest
1123
steps:
1224
- name: Checkout
@@ -16,17 +28,29 @@ jobs:
1628
uses: actions/setup-node@v4
1729
with:
1830
node-version: '20'
31+
cache: 'npm'
1932

2033
- name: Install dependencies
2134
run: npm install
2235

2336
- name: Build
2437
run: npm run build
2538

26-
- name: Deploy
27-
uses: peaceiris/actions-gh-pages@v4
39+
- name: Setup Pages
40+
uses: actions/configure-pages@v5
41+
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
2844
with:
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
30-
publish_dir: ./dist
31-
# The base path is already configured in vite.config.ts, so no need to set it here again.
32-
# If it wasn't, we might need to set a CNAME or adjust the base path in the build step.
45+
path: './dist'
46+
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
needs: build
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)