Skip to content

Commit c420dd9

Browse files
committed
hope to fix the path issue
1 parent a848e10 commit c420dd9

File tree

4 files changed

+54
-13
lines changed

4 files changed

+54
-13
lines changed

.github/workflows/deploy.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches:
6-
- master # Or your default branch (e.g., master)
6+
- master
77
workflow_dispatch:
88

99
jobs:
@@ -16,20 +16,21 @@ jobs:
1616
- name: Setup Node.js
1717
uses: actions/setup-node@v4
1818
with:
19-
node-version: '20' # Or your preferred Node.js version
20-
cache: 'npm' # Or 'yarn', 'pnpm'
19+
node-version: 20
20+
cache: 'npm'
2121

2222
- name: Install dependencies
23-
run: npm install # Or pnpm install, yarn install
23+
run: npm ci
2424

25-
# Set the environment variable and run the generate script
26-
- name: Build and Generate Static Files
27-
# **IMPORTANT:** Replace 'repository-name' with your actual repository name
28-
run: NUXT_APP_BASE_URL=/comforterpdocsnuxt/ npm run generate
25+
- name: Generate static site
26+
env:
27+
BASE_URL: /comforterpdocsnuxt/
28+
run: |
29+
npm run generate
2930
3031
- name: Deploy to GitHub Pages
3132
uses: peaceiris/actions-gh-pages@v3
3233
with:
3334
github_token: ${{ secrets.GITHUB_TOKEN }}
34-
publish_dir: ./.output/public # This is the directory with your generated files
35-
publish_branch: gh-pages # The branch to deploy to (GitHub Pages default)
35+
publish_dir: .output/public
36+
publish_branch: gh-pages

deploy_last.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master # Or your default branch (e.g., master)
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20' # Or your preferred Node.js version
20+
cache: 'npm' # Or 'yarn', 'pnpm'
21+
22+
- name: Install dependencies
23+
run: npm install # Or pnpm install, yarn install
24+
25+
# Set the environment variable and run the generate script
26+
- name: Build and Generate Static Files
27+
# **IMPORTANT:** Replace 'repository-name' with your actual repository name
28+
run: BASE_URL=/comforterpdocsnuxt/ npm run generate
29+
30+
- name: Deploy to GitHub Pages
31+
uses: peaceiris/actions-gh-pages@v3
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./.output/public # This is the directory with your generated files
35+
publish_branch: gh-pages # The branch to deploy to (GitHub Pages default)

nuxt.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ const currentDir = dirname(fileURLToPath(import.meta.url));
66

77
//const base = process.env.NUXT_APP_BASE_URL || '/comforterpdocsnuxt/';
88

9+
console.log('>>> BASE_URL at build time:', process.env.BASE_URL)
10+
11+
912
export default defineNuxtConfig({
1013
nitro: {
1114
//preset: 'github-pages',
1215
preset: process.env.PRESET,
16+
prerender: {
17+
failOnError: false, // Don’t exit build on missing docs/images
18+
},
1319
},
1420
app: {
15-
//baseURL: '/comforterpdocsnuxt/'
1621
//baseURL: process.env.BASE_URL || '/comforterpdocsnuxt/',
17-
baseURL: process.env.BASE_URL,
22+
baseURL: process.env.BASE_URL ?? '/',
1823
head: {
1924
link: [
2025
{ rel: 'icon', type: 'image/svg', href: '/logo_icon_brand_512.png' },

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"build": "nuxt prepare && nuxt build www",
4040
"dev": "nuxt prepare && nuxt dev www",
4141
"generate2": "nuxt prepare && nuxt generate www",
42-
"generate": "nuxt prepare && NUXT_APP_BASE_URL=/comforterpdocsnuxt/ nuxt generate --preset github_pages",
42+
"generate": "nuxt prepare && NUXT_APP_BASE_URL=/comforterpdocsnuxt/ nuxt generate --preset github_pages || echo 'Ignoring prerender errors'",
4343
"preview": "nuxt prepare && nuxt preview www",
4444
"typecheck": "nuxt prepare && nuxt typecheck",
4545
"lint": "eslint .",

0 commit comments

Comments
 (0)