From 8b8b36df11db48bc30367a67fe72306533474152 Mon Sep 17 00:00:00 2001 From: Andre Nogueira Date: Mon, 25 May 2026 17:02:12 +0100 Subject: [PATCH] ci: deploy beer to GitHub Pages on push to main Adds a workflow that builds the Next.js app in static-export mode and publishes it to GitHub Pages. next.config.ts now switches between 'standalone' (Docker) and 'export' (Pages) via the STATIC_EXPORT env var so both deployment paths keep working. A CNAME file pins the subdomain beer.techquests.dev. public/CNAME is copied to out/CNAME by Next.js at build time. Signed-off-by: Andre Nogueira --- .github/workflows/deploy-pages.yml | 43 ++++++++++++++++++++++++++++++ next.config.ts | 5 +++- public/CNAME | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-pages.yml create mode 100644 public/CNAME diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..23dcbb6 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,43 @@ +name: Deploy Pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + env: + STATIC_EXPORT: 'true' + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-node@v5 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run build + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v3 + with: + path: out + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/next.config.ts b/next.config.ts index 68a6c64..7de0a55 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,10 @@ import type { NextConfig } from "next"; +const isStaticExport = process.env.STATIC_EXPORT === "true"; + const nextConfig: NextConfig = { - output: "standalone", + output: isStaticExport ? "export" : "standalone", + images: { unoptimized: isStaticExport }, }; export default nextConfig; diff --git a/public/CNAME b/public/CNAME new file mode 100644 index 0000000..0e20729 --- /dev/null +++ b/public/CNAME @@ -0,0 +1 @@ +beer.techquests.dev