From 742fbbc59565c74e0651f29c3f2861a05a78f5bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:38:26 +0000 Subject: [PATCH 01/11] Initial plan From e2615389222da9ff1adb54d41f804d23e23109e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:42:18 +0000 Subject: [PATCH 02/11] fix: change package.json type to module and update scripts to ES module syntax Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- package.json | 6 +++--- scripts/generate-version.ts | 11 +++++++---- scripts/setup-labels.ts | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5e31df9..b2d8f85 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,11 @@ "name": "geo-invaders", "version": "0.4.0", "private": true, - "type": "commonjs", + "type": "module", "scripts": { - "predev": "NODE_ENV=development node scripts/generate-version.ts", + "predev": "NODE_ENV=development npx tsx scripts/generate-version.ts", "dev": "next dev --turbopack", - "prebuild": "NODE_ENV=production node scripts/generate-version.ts", + "prebuild": "NODE_ENV=production npx tsx scripts/generate-version.ts", "build": "next build", "start": "npx serve@latest out", "lint": "eslint .", diff --git a/scripts/generate-version.ts b/scripts/generate-version.ts index 3414994..ee7a6c4 100755 --- a/scripts/generate-version.ts +++ b/scripts/generate-version.ts @@ -5,12 +5,15 @@ * that can be imported by the application. */ -const fs = require("fs"); -const path = require("path"); +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; -const __dirname = path.dirname(new URL(import.meta.url).pathname); +// Get the directory of the current script +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); -// Read package.jsons +// Read package.json const packageJson = JSON.parse( fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"), ); diff --git a/scripts/setup-labels.ts b/scripts/setup-labels.ts index 8f8227f..0f45477 100755 --- a/scripts/setup-labels.ts +++ b/scripts/setup-labels.ts @@ -6,7 +6,7 @@ * Requires GITHUB_TOKEN environment variable */ -const { Octokit } = require("octokit"); +import { Octokit } from "octokit"; const owner = "notthebestdev"; const repo = "geo-invaders"; From 13d3d1981224afd344e0829af9128faa7f21ff86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:46:52 +0000 Subject: [PATCH 03/11] feat: add workflow_run trigger to deploy workflow for automatic builds after releases Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- .github/workflows/nextjs.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index a4edacf..3113d16 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -9,6 +9,13 @@ on: push: branches: ["prod"] + # Runs after the Release workflow completes successfully + workflow_run: + workflows: ["Release"] + types: + - completed + branches: [dev] + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -27,9 +34,14 @@ concurrency: jobs: lint: runs-on: ubuntu-latest + # Only run if workflow was triggered by push/workflow_dispatch, or if workflow_run concluded successfully + if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout uses: actions/checkout@v6 + with: + # Checkout prod branch when triggered by workflow_run, otherwise use default + ref: ${{ github.event_name == 'workflow_run' && 'prod' || github.ref }} - name: Setup Node uses: actions/setup-node@v6 with: @@ -46,6 +58,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + with: + # Checkout prod branch when triggered by workflow_run, otherwise use default + ref: ${{ github.event_name == 'workflow_run' && 'prod' || github.ref }} - name: Detect package manager id: detect-package-manager run: | From 47289efe225ec415f777ac19e79db184128d7542 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:47:45 +0000 Subject: [PATCH 04/11] fix: add conditional check to build job to prevent running on failed workflow_run Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- .github/workflows/nextjs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index 3113d16..dd252bc 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -55,6 +55,8 @@ jobs: build: runs-on: ubuntu-latest needs: lint + # Only run if workflow was triggered by push/workflow_dispatch, or if workflow_run concluded successfully + if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout uses: actions/checkout@v6 From f8cb8eb74eedded34a7de7c918234df7b881b0c4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:48:34 +0000 Subject: [PATCH 05/11] refactor: simplify conditional expressions in workflow by removing unnecessary curly braces Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- .github/workflows/nextjs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index dd252bc..d450349 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -35,7 +35,7 @@ jobs: lint: runs-on: ubuntu-latest # Only run if workflow was triggered by push/workflow_dispatch, or if workflow_run concluded successfully - if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} + if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' steps: - name: Checkout uses: actions/checkout@v6 @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest needs: lint # Only run if workflow was triggered by push/workflow_dispatch, or if workflow_run concluded successfully - if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} + if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' steps: - name: Checkout uses: actions/checkout@v6 From cbdc07eb2234f19c87f8b4558b0cd0437c588f4c Mon Sep 17 00:00:00 2001 From: TheBestDeveloper Date: Mon, 2 Feb 2026 18:16:38 +0100 Subject: [PATCH 06/11] chore(dependencies): add octokit package for GitHub API integration --- package-lock.json | 284 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 285 insertions(+) diff --git a/package-lock.json b/package-lock.json index 7cf7d26..dd74bee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "eslint-config-next": "^16.1.6", "eslint-plugin-react": "^7.37.5", "husky": "^9.1.7", + "octokit": "^5.0.5", "prettier": "^3.8.1", "tailwindcss": "^4", "tsx": "^4.21.0", @@ -2716,6 +2717,95 @@ "node": ">=12.4.0" } }, + "node_modules/@octokit/app": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@octokit/app/-/app-16.1.2.tgz", + "integrity": "sha512-8j7sEpUYVj18dxvh0KWj6W/l6uAiVRBl1JBDVRqH1VHKAO/G5eRVl4yEoYACjakWers1DjUkcCHyJNQK47JqyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-app": "^8.1.2", + "@octokit/auth-unauthenticated": "^7.0.3", + "@octokit/core": "^7.0.6", + "@octokit/oauth-app": "^8.0.3", + "@octokit/plugin-paginate-rest": "^14.0.0", + "@octokit/types": "^16.0.0", + "@octokit/webhooks": "^14.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-app": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-8.1.2.tgz", + "integrity": "sha512-db8VO0PqXxfzI6GdjtgEFHY9tzqUql5xMFXYA12juq8TeTgPAuiiP3zid4h50lwlIP457p5+56PnJOgd2GGBuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-app": "^9.0.3", + "@octokit/auth-oauth-user": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "toad-cache": "^3.7.0", + "universal-github-app-jwt": "^2.2.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-app": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-9.0.3.tgz", + "integrity": "sha512-+yoFQquaF8OxJSxTb7rnytBIC2ZLbLqA/yb71I4ZXT9+Slw4TziV9j/kyGhUFRRTF2+7WlnIWsePZCWHs+OGjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-device": "^8.0.3", + "@octokit/auth-oauth-user": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-device": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-8.0.3.tgz", + "integrity": "sha512-zh2W0mKKMh/VWZhSqlaCzY7qFyrgd9oTWmTmHaXnHNeQRCZr/CXy2jCgHo4e4dJVTiuxP5dLa0YM5p5QVhJHbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/oauth-methods": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-user": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-6.0.2.tgz", + "integrity": "sha512-qLoPPc6E6GJoz3XeDG/pnDhJpTkODTGG4kY0/Py154i/I003O9NazkrwJwRuzgCalhzyIeWQ+6MDvkUmKXjg/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-device": "^8.0.3", + "@octokit/oauth-methods": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/@octokit/auth-token": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz", @@ -2726,6 +2816,20 @@ "node": ">= 20" } }, + "node_modules/@octokit/auth-unauthenticated": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-unauthenticated/-/auth-unauthenticated-7.0.3.tgz", + "integrity": "sha512-8Jb1mtUdmBHL7lGmop9mU9ArMRUTRhg8vp0T1VtZ4yd9vEm3zcLwmjQkhNEduKawOOORie61xhtYIhTDN+ZQ3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/@octokit/core": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz", @@ -2774,6 +2878,52 @@ "node": ">= 20" } }, + "node_modules/@octokit/oauth-app": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@octokit/oauth-app/-/oauth-app-8.0.3.tgz", + "integrity": "sha512-jnAjvTsPepyUaMu9e69hYBuozEPgYqP4Z3UnpmvoIzHDpf8EXDGvTY1l1jK0RsZ194oRd+k6Hm13oRU8EoDFwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-app": "^9.0.2", + "@octokit/auth-oauth-user": "^6.0.1", + "@octokit/auth-unauthenticated": "^7.0.2", + "@octokit/core": "^7.0.5", + "@octokit/oauth-authorization-url": "^8.0.0", + "@octokit/oauth-methods": "^6.0.1", + "@types/aws-lambda": "^8.10.83", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-authorization-url": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-8.0.0.tgz", + "integrity": "sha512-7QoLPRh/ssEA/HuHBHdVdSgF8xNLz/Bc5m9fZkArJE5bb6NmVkDm3anKxXPmN1zh6b5WKZPRr3697xKT/yM3qQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-methods": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-6.0.2.tgz", + "integrity": "sha512-HiNOO3MqLxlt5Da5bZbLV8Zarnphi4y9XehrbaFMkcoJ+FL7sMxH/UlUsCVxpddVu4qvNDrBdaTVE2o4ITK8ng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/oauth-authorization-url": "^8.0.0", + "@octokit/request": "^10.0.6", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/@octokit/openapi-types": { "version": "27.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz", @@ -2781,6 +2931,26 @@ "dev": true, "license": "MIT" }, + "node_modules/@octokit/openapi-webhooks-types": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-webhooks-types/-/openapi-webhooks-types-12.1.0.tgz", + "integrity": "sha512-WiuzhOsiOvb7W3Pvmhf8d2C6qaLHXrWiLBP4nJ/4kydu+wpagV5Fkz9RfQwV2afYzv3PB+3xYgp4mAdNGjDprA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-graphql": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-6.0.0.tgz", + "integrity": "sha512-crfpnIoFiBtRkvPqOyLOsw12XsveYuY2ieP6uYDosoUegBJpSVxGwut9sxUgFFcll3VTOTqpUf8yGd8x1OmAkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, "node_modules/@octokit/plugin-paginate-rest": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz", @@ -2826,6 +2996,41 @@ "@octokit/core": ">=6" } }, + "node_modules/@octokit/plugin-retry": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-8.0.3.tgz", + "integrity": "sha512-vKGx1i3MC0za53IzYBSBXcrhmd+daQDzuZfYDd52X5S0M2otf3kVZTVP8bLA3EkU0lTvd1WEC2OlNNa4G+dohA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=7" + } + }, + "node_modules/@octokit/plugin-throttling": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-11.0.3.tgz", + "integrity": "sha512-34eE0RkFCKycLl2D2kq7W+LovheM/ex3AwZCYN8udpi6bxsyjZidb2McXs69hZhLmJlDqTSP8cH+jSRpiaijBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": "^7.0.0" + } + }, "node_modules/@octokit/request": { "version": "10.0.7", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.7.tgz", @@ -2882,6 +3087,31 @@ "@octokit/openapi-types": "^27.0.0" } }, + "node_modules/@octokit/webhooks": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-14.2.0.tgz", + "integrity": "sha512-da6KbdNCV5sr1/txD896V+6W0iamFWrvVl8cHkBSPT+YlvmT3DwXa4jxZnQc+gnuTEqSWbBeoSZYTayXH9wXcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-webhooks-types": "12.1.0", + "@octokit/request-error": "^7.0.0", + "@octokit/webhooks-methods": "^6.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/webhooks-methods": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-6.0.0.tgz", + "integrity": "sha512-MFlzzoDJVw/GcbfzVC1RLR36QqkTLUf79vLVO3D+xn7r0QgxnFoLZgtrzxiQErAjFUOdH6fas2KeQJ1yr/qaXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, "node_modules/@radix-ui/primitive": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz", @@ -3803,6 +4033,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/aws-lambda": { + "version": "8.10.160", + "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.160.tgz", + "integrity": "sha512-uoO4QVQNWFPJMh26pXtmtrRfGshPUSpMZGUyUQY20FhfHEElEBOPKgVmFs1z+kbpyBsRs2JnoOPT7++Z4GA9pA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/conventional-commits-parser": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.2.tgz", @@ -4837,6 +5074,13 @@ "readable-stream": "^3.4.0" } }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true, + "license": "MIT" + }, "node_modules/brace-expansion": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", @@ -8742,6 +8986,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/octokit": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/octokit/-/octokit-5.0.5.tgz", + "integrity": "sha512-4+/OFSqOjoyULo7eN7EA97DE0Xydj/PW5aIckxqQIoFjFwqXKuFCvXUJObyJfBF9Khu4RL/jlDRI9FPaMGfPnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/app": "^16.1.2", + "@octokit/core": "^7.0.6", + "@octokit/oauth-app": "^8.0.3", + "@octokit/plugin-paginate-graphql": "^6.0.0", + "@octokit/plugin-paginate-rest": "^14.0.0", + "@octokit/plugin-rest-endpoint-methods": "^17.0.0", + "@octokit/plugin-retry": "^8.0.3", + "@octokit/plugin-throttling": "^11.0.3", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "@octokit/webhooks": "^14.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -10273,6 +10540,16 @@ "node": ">=8.0" } }, + "node_modules/toad-cache": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz", + "integrity": "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -10536,6 +10813,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/universal-github-app-jwt": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.2.tgz", + "integrity": "sha512-dcmbeSrOdTnsjGjUfAlqNDJrhxXizjAz94ija9Qw8YkZ1uu0d+GoZzyH+Jb9tIIqvGsadUfwg+22k5aDqqwzbw==", + "dev": true, + "license": "MIT" + }, "node_modules/universal-user-agent": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz", diff --git a/package.json b/package.json index b2d8f85..e1889f7 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "eslint-config-next": "^16.1.6", "eslint-plugin-react": "^7.37.5", "husky": "^9.1.7", + "octokit": "^5.0.5", "prettier": "^3.8.1", "tailwindcss": "^4", "tsx": "^4.21.0", From 0f5235660f40e66587554400b4cd498d63b39e2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:27:58 +0000 Subject: [PATCH 07/11] fix: add build:local script for local testing without GitHub Pages base path Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- README.md | 23 +++++++++++++++++++++-- package.json | 4 +++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 99b1428..3c7e8bd 100644 --- a/README.md +++ b/README.md @@ -136,13 +136,32 @@ npm run dev ## šŸ“¦ Build & Deploy -Build for production: +### Production Build (for GitHub Pages) + +Build for production deployment: ```bash npm run build ``` -The app is automatically deployed to GitHub Pages on every push to the `main` branch. +This creates an optimized static export in the `out` directory with the `/geo-invaders` base path configured for GitHub Pages. + +### Local Testing Build + +To build and test the production build locally: + +```bash +npm run build:local +npm run start +``` + +The `build:local` script creates a build without the GitHub Pages base path, making it suitable for local testing at `http://localhost:3000`. + +**Note:** Don't use `npm run build` followed by `npm run start` for local testing, as the production build includes the `/geo-invaders` base path and won't work correctly on localhost. + +### Deployment + +The app is automatically deployed to GitHub Pages on every push to the `prod` branch. ## šŸ¤ Contributing diff --git a/package.json b/package.json index e1889f7..6dd1709 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "dev": "next dev --turbopack", "prebuild": "NODE_ENV=production npx tsx scripts/generate-version.ts", "build": "next build", - "start": "npx serve@latest out", + "prebuild:local": "NODE_ENV=development npx tsx scripts/generate-version.ts", + "build:local": "NODE_ENV=development next build", + "start": "npx serve@latest out -s", "lint": "eslint .", "format": "prettier --write .", "version-packages": "npx @changesets/cli version", From 1071ac0426ff546d4c3922b589dac9635b1b3631 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:39:03 +0000 Subject: [PATCH 08/11] fix: use repository_dispatch to trigger deploy workflow after release Replace workflow_run trigger with repository_dispatch event to ensure the deploy workflow runs when Release workflow merges dev into prod. The GITHUB_TOKEN limitation prevents workflow_run from working reliably in this scenario. Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- .github/scripts/create-release.ts | 26 ++++++++++++++++++++++++++ .github/workflows/nextjs.yml | 21 +++++++-------------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/.github/scripts/create-release.ts b/.github/scripts/create-release.ts index 72d989c..a354905 100644 --- a/.github/scripts/create-release.ts +++ b/.github/scripts/create-release.ts @@ -50,6 +50,32 @@ async function createGitHubRelease() { console.log(`\nšŸš€ Pushing changes...`); execSync("git push origin prod", { stdio: "inherit" }); console.log(`āœ… Successfully pushed changes`); + + // Trigger the deployment workflow via repository_dispatch + console.log(`\nšŸ”” Triggering deployment workflow...`); + try { + const dispatchOctokit = new Octokit({ + auth: process.env.GITHUB_TOKEN, + }); + + await dispatchOctokit.rest.repos.createDispatchEvent({ + owner, + repo, + event_type: "deploy-to-pages", + client_payload: { + source: "release-workflow", + branch: "prod", + }, + }); + console.log(`āœ… Deployment workflow triggered successfully`); + } catch (dispatchError) { + console.warn( + `āš ļø Failed to trigger deployment workflow: ${dispatchError}`, + ); + console.log( + "You can manually trigger the deployment from the Actions tab", + ); + } } catch (gitError) { console.error("āŒ Git operation failed:", gitError); process.exit(1); diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index d450349..ffe0550 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -9,12 +9,9 @@ on: push: branches: ["prod"] - # Runs after the Release workflow completes successfully - workflow_run: - workflows: ["Release"] - types: - - completed - branches: [dev] + # Triggered by repository dispatch event from Release workflow + repository_dispatch: + types: [deploy-to-pages] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -34,14 +31,12 @@ concurrency: jobs: lint: runs-on: ubuntu-latest - # Only run if workflow was triggered by push/workflow_dispatch, or if workflow_run concluded successfully - if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' steps: - name: Checkout uses: actions/checkout@v6 with: - # Checkout prod branch when triggered by workflow_run, otherwise use default - ref: ${{ github.event_name == 'workflow_run' && 'prod' || github.ref }} + # Checkout prod branch for repository_dispatch events, otherwise use default + ref: ${{ github.event_name == 'repository_dispatch' && 'prod' || github.ref }} - name: Setup Node uses: actions/setup-node@v6 with: @@ -55,14 +50,12 @@ jobs: build: runs-on: ubuntu-latest needs: lint - # Only run if workflow was triggered by push/workflow_dispatch, or if workflow_run concluded successfully - if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' steps: - name: Checkout uses: actions/checkout@v6 with: - # Checkout prod branch when triggered by workflow_run, otherwise use default - ref: ${{ github.event_name == 'workflow_run' && 'prod' || github.ref }} + # Checkout prod branch for repository_dispatch events, otherwise use default + ref: ${{ github.event_name == 'repository_dispatch' && 'prod' || github.ref }} - name: Detect package manager id: detect-package-manager run: | From 33a51ebd0450f4bc3f98f1d81b0699f645639aa0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 17:39:56 +0000 Subject: [PATCH 09/11] refactor: improve error handling in repository dispatch trigger Add GITHUB_TOKEN validation and better error messages for the repository dispatch event to help debug deployment trigger failures. Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- .github/scripts/create-release.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/scripts/create-release.ts b/.github/scripts/create-release.ts index a354905..c53bea9 100644 --- a/.github/scripts/create-release.ts +++ b/.github/scripts/create-release.ts @@ -54,6 +54,13 @@ async function createGitHubRelease() { // Trigger the deployment workflow via repository_dispatch console.log(`\nšŸ”” Triggering deployment workflow...`); try { + // Validate GITHUB_TOKEN is available + if (!process.env.GITHUB_TOKEN) { + throw new Error( + "GITHUB_TOKEN is required to trigger deployment workflow", + ); + } + const dispatchOctokit = new Octokit({ auth: process.env.GITHUB_TOKEN, }); @@ -69,8 +76,12 @@ async function createGitHubRelease() { }); console.log(`āœ… Deployment workflow triggered successfully`); } catch (dispatchError) { + const errorMessage = + dispatchError instanceof Error + ? dispatchError.message + : String(dispatchError); console.warn( - `āš ļø Failed to trigger deployment workflow: ${dispatchError}`, + `āš ļø Failed to trigger deployment workflow: ${errorMessage}`, ); console.log( "You can manually trigger the deployment from the Actions tab", From c884571864f1201eb201fba7600277228e219bb5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:25:06 +0000 Subject: [PATCH 10/11] fix: remove NODE_ENV override from build:local to prevent Next.js warnings Next.js only accepts 'production', 'development' (for dev server), or 'test' as valid NODE_ENV values. Setting NODE_ENV=development during build causes warnings and potential issues. The build:local script now runs without NODE_ENV override, allowing Next.js to use production mode while still building without the GitHub Pages base path. Co-authored-by: notthebestdev <129324066+notthebestdev@users.noreply.github.com> --- next.config.mjs | 7 +++++-- package.json | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 566141d..db71875 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,8 +1,11 @@ -const isProduction = process.env.NODE_ENV === "production"; +// Use NODE_ENV to determine if this is a production build for GitHub Pages +// When NODE_ENV is "production", we're building for deployment to GitHub Pages +// Otherwise (including undefined/development), we're building for local testing +const isGitHubPagesBuild = process.env.NODE_ENV === "production"; const nextConfig = { output: "export", - basePath: isProduction ? "/geo-invaders" : "", + basePath: isGitHubPagesBuild ? "/geo-invaders" : "", }; export default nextConfig; diff --git a/package.json b/package.json index 6dd1709..2cceef7 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "dev": "next dev --turbopack", "prebuild": "NODE_ENV=production npx tsx scripts/generate-version.ts", "build": "next build", - "prebuild:local": "NODE_ENV=development npx tsx scripts/generate-version.ts", - "build:local": "NODE_ENV=development next build", + "prebuild:local": "npx tsx scripts/generate-version.ts", + "build:local": "next build", "start": "npx serve@latest out -s", "lint": "eslint .", "format": "prettier --write .", From e795bbc0847dcfcd657f21d6b1cbf9ca7db52bd3 Mon Sep 17 00:00:00 2001 From: TheBestDeveloper Date: Mon, 2 Feb 2026 19:47:25 +0100 Subject: [PATCH 11/11] chore: format --- .changeset/dependencies-GH-100.md | 5 ++++- .changeset/dependencies-GH-101.md | 5 ++++- .changeset/dependencies-GH-102.md | 5 ++++- .changeset/dependencies-GH-103.md | 5 ++++- .changeset/dependencies-GH-104.md | 5 ++++- .changeset/dependencies-GH-96.md | 6 ++++-- .changeset/dependencies-GH-98.md | 6 +++++- .changeset/dependencies-GH-99.md | 5 ++++- 8 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.changeset/dependencies-GH-100.md b/.changeset/dependencies-GH-100.md index 2519422..681208f 100644 --- a/.changeset/dependencies-GH-100.md +++ b/.changeset/dependencies-GH-100.md @@ -5,16 +5,19 @@ :arrow_up: Bump react-dom from 19.2.3 to 19.2.4 Bumps [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) from 19.2.3 to 19.2.4. + - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.2.4/packages/react-dom) --- + updated-dependencies: + - dependency-name: react-dom dependency-version: 19.2.4 dependency-type: direct:production update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-101.md b/.changeset/dependencies-GH-101.md index ef5b6b1..c1a47fb 100644 --- a/.changeset/dependencies-GH-101.md +++ b/.changeset/dependencies-GH-101.md @@ -5,16 +5,19 @@ :arrow_up: Bump maplibre-gl from 5.16.0 to 5.17.0 Bumps [maplibre-gl](https://github.com/maplibre/maplibre-gl-js) from 5.16.0 to 5.17.0. + - [Release notes](https://github.com/maplibre/maplibre-gl-js/releases) - [Changelog](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/maplibre/maplibre-gl-js/compare/v5.16.0...v5.17.0) --- + updated-dependencies: + - dependency-name: maplibre-gl dependency-version: 5.17.0 dependency-type: direct:production update-type: version-update:semver-minor -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-102.md b/.changeset/dependencies-GH-102.md index ba92934..0e30076 100644 --- a/.changeset/dependencies-GH-102.md +++ b/.changeset/dependencies-GH-102.md @@ -5,15 +5,18 @@ :arrow_up: Bump baseline-browser-mapping from 2.9.17 to 2.9.19 Bumps [baseline-browser-mapping](https://github.com/web-platform-dx/baseline-browser-mapping) from 2.9.17 to 2.9.19. + - [Release notes](https://github.com/web-platform-dx/baseline-browser-mapping/releases) - [Commits](https://github.com/web-platform-dx/baseline-browser-mapping/compare/v2.9.17...v2.9.19) --- + updated-dependencies: + - dependency-name: baseline-browser-mapping dependency-version: 2.9.19 dependency-type: direct:development update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-103.md b/.changeset/dependencies-GH-103.md index 4eec82d..a03e54a 100644 --- a/.changeset/dependencies-GH-103.md +++ b/.changeset/dependencies-GH-103.md @@ -5,16 +5,19 @@ :arrow_up: Bump eslint-config-next from 16.1.4 to 16.1.6 Bumps [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) from 16.1.4 to 16.1.6. + - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/commits/v16.1.6/packages/eslint-config-next) --- + updated-dependencies: + - dependency-name: eslint-config-next dependency-version: 16.1.6 dependency-type: direct:development update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-104.md b/.changeset/dependencies-GH-104.md index 827628a..88cac0a 100644 --- a/.changeset/dependencies-GH-104.md +++ b/.changeset/dependencies-GH-104.md @@ -5,15 +5,18 @@ :arrow_up: Bump lucide-react from 0.562.0 to 0.563.0 Bumps [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) from 0.562.0 to 0.563.0. + - [Release notes](https://github.com/lucide-icons/lucide/releases) - [Commits](https://github.com/lucide-icons/lucide/commits/0.563.0/packages/lucide-react) --- + updated-dependencies: + - dependency-name: lucide-react dependency-version: 0.563.0 dependency-type: direct:production update-type: version-update:semver-minor -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-96.md b/.changeset/dependencies-GH-96.md index ab43848..b8bd5b4 100644 --- a/.changeset/dependencies-GH-96.md +++ b/.changeset/dependencies-GH-96.md @@ -6,18 +6,20 @@ Bumps the npm_and_yarn group with 1 update in the / directory: [next](https://github.com/vercel/next.js). - Updates `next` from 16.1.4 to 16.1.5 + - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v16.1.4...v16.1.5) --- + updated-dependencies: + - dependency-name: next dependency-version: 16.1.5 dependency-type: direct:production dependency-group: npm_and_yarn -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-98.md b/.changeset/dependencies-GH-98.md index 09b6285..ff1f4ec 100644 --- a/.changeset/dependencies-GH-98.md +++ b/.changeset/dependencies-GH-98.md @@ -7,16 +7,20 @@ Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) and [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react). These dependencies needed to be updated together. Updates `react` from 19.2.3 to 19.2.4 + - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.2.4/packages/react) Updates `@types/react` from 19.2.9 to 19.2.10 + - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- + updated-dependencies: + - dependency-name: react dependency-version: 19.2.4 dependency-type: direct:production @@ -25,6 +29,6 @@ updated-dependencies: dependency-version: 19.2.10 dependency-type: direct:development update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-99.md b/.changeset/dependencies-GH-99.md index 9e574e2..cedc61b 100644 --- a/.changeset/dependencies-GH-99.md +++ b/.changeset/dependencies-GH-99.md @@ -5,15 +5,18 @@ :arrow_up: Bump simple-icons from 16.6.0 to 16.6.1 Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 16.6.0 to 16.6.1. + - [Release notes](https://github.com/simple-icons/simple-icons/releases) - [Commits](https://github.com/simple-icons/simple-icons/compare/16.6.0...16.6.1) --- + updated-dependencies: + - dependency-name: simple-icons dependency-version: 16.6.1 dependency-type: direct:production update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot]