Skip to content

Commit c664e78

Browse files
committed
refactor GitHub Actions workflow for deployment and update Vite base path
1 parent 9a332a8 commit c664e78

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

.github/workflows/publish.yml

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,55 @@
1-
name: Deploy to GitHub Pages
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
23

34
on:
5+
# Runs on pushes targeting the default branch
46
push:
5-
branches:
6-
- main # or your primary branch
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
710
workflow_dispatch:
811

12+
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
923
jobs:
10-
build-and-deploy:
24+
# Single deploy job since we're just deploying
25+
deploy:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
1129
runs-on: ubuntu-latest
1230
steps:
1331
- name: Checkout
14-
uses: actions/checkout@v4
15-
32+
uses: actions/checkout@v5
1633
- name: Install pnpm
1734
uses: pnpm/action-setup@v4
1835
with:
1936
version: 9
20-
21-
- name: Setup Node.js
22-
uses: actions/setup-node@v4
37+
- name: Set up Node
38+
uses: actions/setup-node@v6
2339
with:
24-
node-version: "20" # or your preferred Node.js version
25-
40+
node-version: "20"
41+
cache: "pnpm"
2642
- name: Install dependencies
2743
run: pnpm install
28-
2944
- name: Build project
3045
run: pnpm run build
31-
32-
- name: Deploy to GitHub Pages
33-
uses: peaceiris/actions-gh-pages@v4
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v5
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v4
3450
with:
35-
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
publish_dir: ./dist # Assumes your build output is in 'dist'
51+
# Upload dist folder
52+
path: "./dist"
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const ssgOptions: ViteSSGOptions = {
2929

3030
// https://vitejs.dev/config
3131
export default defineConfig({
32+
base: "/",
3233
resolve: {
3334
alias: {
3435
"@": fileURLToPath(new URL("./src", import.meta.url)),

0 commit comments

Comments
 (0)