|
1 | | -name: CI |
| 1 | +name: Deploy Static Site to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - master |
7 | | - |
8 | 7 | pull_request: |
9 | 8 | branches: |
10 | 9 | - master |
11 | 10 |
|
12 | 11 | jobs: |
13 | | - build: |
14 | | - strategy: |
15 | | - fail-fast: false |
16 | | - runs-on: ubuntu-latest |
17 | | - steps: |
18 | | - - uses: actions/checkout@v4 |
19 | | - |
20 | | - - name: Install pnpm |
21 | | - uses: pnpm/action-setup@v4 |
22 | | - with: |
23 | | - run_install: false |
24 | | - |
25 | | - - uses: actions/setup-node@v4 |
26 | | - with: |
27 | | - node-version: lts/* |
28 | | - cache: pnpm |
29 | | - |
30 | | - - name: Install dependencies |
31 | | - run: pnpm install --frozen-lockfile |
32 | | - |
33 | | - - name: Build |
34 | | - run: pnpm run build |
35 | | - |
36 | | - generate: |
37 | | - strategy: |
38 | | - fail-fast: false |
| 12 | + # This single job handles installing dependencies, generating the static site, and deploying it. |
| 13 | + deploy_pages: |
39 | 14 | runs-on: ubuntu-latest |
40 | 15 | steps: |
41 | | - - uses: actions/checkout@v4 |
| 16 | + - name: Checkout Repository |
| 17 | + uses: actions/checkout@v4 |
42 | 18 |
|
43 | 19 | - name: Install pnpm |
44 | 20 | uses: pnpm/action-setup@v4 |
45 | 21 | with: |
46 | | - run_install: false |
| 22 | + run_install: false # Skip initial install here |
47 | 23 |
|
48 | | - - uses: actions/setup-node@v4 |
| 24 | + - name: Setup Node.js |
| 25 | + uses: actions/setup-node@v4 |
49 | 26 | with: |
50 | 27 | node-version: lts/* |
51 | 28 | cache: pnpm |
52 | 29 |
|
53 | | - - name: Install dependencies |
| 30 | + - name: Install Dependencies |
| 31 | + # Using --frozen-lockfile ensures reproducible builds |
54 | 32 | run: pnpm install --frozen-lockfile |
55 | 33 |
|
56 | | - - name: Generate |
| 34 | + - name: Generate Static Site |
| 35 | + # This step runs your "generate" script: "nuxt prepare && nuxt generate www" |
| 36 | + # This command is responsible for generating files into 'www/.output/public' |
| 37 | + env: |
| 38 | + NUXT_APP_BASE_URL: /comforterpdocsnuxt/ # Setting the BASE_URL environment variable for Nuxt |
57 | 39 | run: pnpm run generate |
58 | 40 |
|
59 | 41 | - name: Deploy to GitHub Pages |
| 42 | + # This action pushes the generated content to the 'gh-pages' branch |
60 | 43 | uses: peaceiris/actions-gh-pages@v3 |
61 | 44 | with: |
62 | 45 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + # Ensure this path matches the output of 'nuxt generate www' |
63 | 47 | publish_dir: www/.output/public |
64 | 48 | publish_branch: gh-pages |
| 49 | + # Optional: Add a custom commit message |
| 50 | + commit_message: Deploying static Nuxt site to gh-pages |
0 commit comments