Skip to content

Commit 60cb0ec

Browse files
FIX (deploy): Make deployment atomic
1 parent ac77912 commit 60cb0ec

File tree

1 file changed

+62
-47
lines changed

1 file changed

+62
-47
lines changed

.github/workflows/deploy.yml

Lines changed: 62 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,74 @@
11
name: Deploy Next.js to GitHub Pages
22

33
on:
4-
push:
5-
branches:
6-
- website
7-
workflow_dispatch:
4+
push:
5+
branches:
6+
- website
7+
workflow_dispatch:
88

99
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1010
permissions:
11-
contents: read
12-
pages: write
13-
id-token: write
11+
contents: read
12+
pages: write
13+
id-token: write
1414

1515
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1616
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1717
concurrency:
18-
group: "pages"
19-
cancel-in-progress: false
18+
group: "pages"
19+
cancel-in-progress: false
2020

2121
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

Comments
 (0)