Skip to content

Commit c861f0e

Browse files
Updated static workflow to build static version of site and post to gh-pages.
1 parent 77db9f9 commit c861f0e

1 file changed

Lines changed: 3 additions & 29 deletions

File tree

.github/workflows/nextjs-static-gh-pages.yml

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 🚀 Deploy Static Next.js to GitHub Pages
22

33
on:
44
push:
5-
branches: ['gh-static'] # Triggers on push to this branch
5+
branches: ['main'] # Triggers on push to main branch
66
workflow_dispatch: # Allows manual triggering
77

88
permissions:
@@ -19,24 +19,7 @@ jobs:
1919
name: 🏗 Build Static Site
2020
runs-on: ubuntu-latest
2121

22-
# ===================================================================
23-
# THE FIX, PART 1: Create a temporary PostgreSQL database service
24-
# This database will only exist for the duration of this build job.
25-
# ===================================================================
26-
services:
27-
postgres:
28-
image: postgres:15-alpine
29-
env:
30-
POSTGRES_USER: user
31-
POSTGRES_PASSWORD: password
32-
POSTGRES_DB: temp_db
33-
ports:
34-
- 5432:5432 # Map port 5432 on the runner to the container's port 5432
35-
options: >-
36-
--health-cmd pg_isready
37-
--health-interval 10s
38-
--health-timeout 5s
39-
--health-retries 5
22+
4023

4124
steps:
4225
- name: 🔍 Checkout repository
@@ -74,18 +57,9 @@ jobs:
7457
run: ${{ env.manager }} ${{ env.command }}
7558

7659
- name: 🏗 Generate Static Build
77-
# =====================================================================
78-
# THE FIX, PART 2: Provide the database URL to the build command
79-
# This points your app to the temporary database service we created above.
80-
# Note the removal of the deprecated 'next export' command.
81-
# =====================================================================
82-
env:
83-
DATABASE_URL: 'postgresql://user:password@localhost:5432/temp_db'
84-
SHADOW_DATABASE_URL: 'postgresql://user:password@localhost:5432/temp_db_shadow'
85-
# Add any other required build-time environment variables here
8660
run: |
8761
echo "Building static files..."
88-
${{ env.runner }} next build
62+
pnpm build:static
8963
touch out/.nojekyll
9064
9165
- name: 📤 Upload static site

0 commit comments

Comments
 (0)