|
1 |
| -name: Deploy Nuxt to GitHub Pages |
2 |
| - |
| 1 | +# https://github.com/actions/deploy-pages#usage |
| 2 | +name: Deploy to GitHub Pages |
3 | 3 | on:
|
| 4 | + workflow_dispatch: |
4 | 5 | push:
|
5 | 6 | branches:
|
6 |
| - - prod # or your default branch |
7 |
| - |
| 7 | + - main |
8 | 8 | jobs:
|
9 |
| - build-and-deploy: |
| 9 | + build: |
10 | 10 | runs-on: ubuntu-latest
|
11 |
| - |
12 | 11 | steps:
|
13 |
| - - name: Checkout code |
14 |
| - uses: actions/checkout@v4 |
15 |
| - |
16 |
| - - name: Setup Node.js |
17 |
| - uses: actions/setup-node@v4 |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - run: corepack enable |
| 14 | + - uses: actions/setup-node@v4 |
18 | 15 | with:
|
19 |
| - node-version: 18 |
20 |
| - |
21 |
| - - name: Install dependencies |
22 |
| - run: npm install |
23 |
| - |
24 |
| - - name: Build Nuxt app |
25 |
| - run: npm run build |
26 |
| - |
27 |
| - - name: Export static site |
28 |
| - run: npm run generate |
29 |
| - |
30 |
| - - name: Deploy to GitHub Pages |
31 |
| - uses: peaceiris/actions-gh-pages@v4 |
| 16 | + node-version: "20" |
| 17 | + # Pick your own package manager and build script |
| 18 | + - run: npm install |
| 19 | + - run: npx nuxt build --preset github_pages |
| 20 | + - name: Upload artifact |
| 21 | + uses: actions/upload-pages-artifact@v3 |
32 | 22 | with:
|
33 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
34 |
| - publish_dir: .output/public |
| 23 | + path: ./.output/public |
| 24 | + # Deployment job |
| 25 | + deploy: |
| 26 | + # Add a dependency to the build job |
| 27 | + needs: build |
| 28 | + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment |
| 29 | + permissions: |
| 30 | + pages: write # to deploy to Pages |
| 31 | + id-token: write # to verify the deployment originates from an appropriate source |
| 32 | + # Deploy to the github_pages environment |
| 33 | + environment: |
| 34 | + name: github-pages |
| 35 | + url: ${{ steps.deployment.outputs.page_url }} |
| 36 | + # Specify runner + deployment step |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Deploy to GitHub Pages |
| 40 | + id: deployment |
| 41 | + uses: actions/deploy-pages@v4 |
| 42 | + |
0 commit comments