|
1 | 1 | name: Deploy Next.js to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - website |
7 | | - workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - website |
| 7 | + workflow_dispatch: |
8 | 8 |
|
9 | 9 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
10 | 10 | permissions: |
11 | | - contents: read |
12 | | - pages: write |
13 | | - id-token: write |
| 11 | + contents: read |
| 12 | + pages: write |
| 13 | + id-token: write |
14 | 14 |
|
15 | 15 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
16 | 16 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
17 | 17 | concurrency: |
18 | | - group: "pages" |
19 | | - cancel-in-progress: false |
| 18 | + group: "pages" |
| 19 | + cancel-in-progress: false |
20 | 20 |
|
21 | 21 | jobs: |
22 | | - build: |
23 | | - runs-on: ubuntu-latest |
24 | | - steps: |
25 | | - - name: Checkout |
26 | | - uses: actions/checkout@v4 |
27 | | - |
28 | | - - name: Setup Node.js |
29 | | - uses: actions/setup-node@v4 |
30 | | - with: |
31 | | - node-version: "20" |
32 | | - cache: "npm" |
33 | | - |
34 | | - - name: Setup Pages |
35 | | - uses: actions/configure-pages@v5 |
36 | | - with: |
37 | | - static_site_generator: next |
38 | | - |
39 | | - - name: Install dependencies |
40 | | - run: npm ci |
41 | | - |
42 | | - - name: Build with Next.js |
43 | | - run: npm run build |
44 | | - |
45 | | - - name: Upload artifact |
46 | | - uses: actions/upload-pages-artifact@v3 |
47 | | - with: |
48 | | - path: ./out |
49 | | - |
50 | | - deploy: |
51 | | - environment: |
52 | | - name: github-pages |
53 | | - url: ${{ steps.deployment.outputs.page_url }} |
54 | | - runs-on: ubuntu-latest |
55 | | - needs: build |
56 | | - steps: |
57 | | - - name: Deploy to GitHub Pages |
58 | | - id: deployment |
59 | | - uses: actions/deploy-pages@v4 |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Setup Node.js |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: "20" |
| 32 | + cache: "npm" |
| 33 | + |
| 34 | + - name: Setup Pages |
| 35 | + uses: actions/configure-pages@v5 |
| 36 | + with: |
| 37 | + static_site_generator: next |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: npm ci |
| 41 | + |
| 42 | + - name: Build with Next.js |
| 43 | + run: npm run build |
| 44 | + |
| 45 | + - name: Add .nojekyll file |
| 46 | + run: touch ./out/.nojekyll |
| 47 | + |
| 48 | + - name: Verify build output |
| 49 | + run: | |
| 50 | + if [ ! -f "./out/index.html" ]; then |
| 51 | + echo "Error: index.html not found in build output" |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + echo "Build verification successful" |
| 55 | +
|
| 56 | + - name: Upload artifact |
| 57 | + uses: actions/upload-pages-artifact@v3 |
| 58 | + with: |
| 59 | + path: ./out |
| 60 | + |
| 61 | + deploy: |
| 62 | + environment: |
| 63 | + name: github-pages |
| 64 | + url: ${{ steps.deployment.outputs.page_url }} |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: build |
| 67 | + steps: |
| 68 | + - name: Deploy to GitHub Pages |
| 69 | + id: deployment |
| 70 | + uses: actions/deploy-pages@v4 |
| 71 | + with: |
| 72 | + timeout: 600000 |
| 73 | + error_count: 10 |
| 74 | + reporting_interval: 5000 |
0 commit comments