From abe41b673666b4085dc44f7ee5e3426cf33bcb56 Mon Sep 17 00:00:00 2001 From: Ryan Kelly <94ryan.kelly@gmail.com> Date: Wed, 2 Sep 2026 09:32:18 +0100 Subject: [PATCH 1/2] feat(ci): add preview slot support for WebGL export and deployment --- .github/scripts/deploy-vercel.ps1 | 26 ++++++++++++++++---------- .github/workflows/web-export.yml | 10 +++++++++- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/scripts/deploy-vercel.ps1 b/.github/scripts/deploy-vercel.ps1 index bba8cd8..cb9eddb 100644 --- a/.github/scripts/deploy-vercel.ps1 +++ b/.github/scripts/deploy-vercel.ps1 @@ -6,7 +6,7 @@ # docs/WEB_EXPORT.md. # # Inputs (environment): -# EVENT_NAME, GIT_REF, IN_TARGET (blank = preview), ALIAS_PREVIEW, BUILD_COMMIT, VERCEL_TOKEN +# EVENT_NAME, GIT_REF, IN_TARGET (blank = preview), ALIAS_PREVIEW, SLOT_NUMBER, BUILD_COMMIT, VERCEL_TOKEN Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' @@ -15,11 +15,14 @@ $PSNativeCommandUseErrorActionPreference = $true Copy-Item infra/vercel/vercel.json build/web/vercel.json -Force npm i -g vercel@latest -# Target is STATED, not inferred from the ref. It used to be "main means --prod", -# which made a dispatch the wrong branch away from silently publishing to -# maze.ryankelly.dev -- an unacceptable footgun now that agents dispatch this -# workflow to get preview URLs (see docs/BUILD_VERIFICATION.md). -$target = if ($env:EVENT_NAME -eq 'push') { 'production' } +# Determine if this deploy targets a preview slot (slot/1..3) +$slot = if ($env:GIT_REF -match '^refs/heads/slot/([0-9]+)$') { $Matches[1] } + elseif (![string]::IsNullOrWhiteSpace($env:SLOT_NUMBER)) { $env:SLOT_NUMBER } + else { $null } + +# Target is STATED, not inferred from the ref. +$target = if ($env:EVENT_NAME -eq 'push' -and $env:GIT_REF -eq 'refs/heads/main') { 'production' } + elseif ($slot) { 'slot' } elseif ([string]::IsNullOrWhiteSpace($env:IN_TARGET)) { 'preview' } else { $env:IN_TARGET } @@ -33,10 +36,13 @@ if ($target -eq 'production') { $url = (vercel deploy build/web --yes --token=$env:VERCEL_TOKEN) | Select-Object -Last 1 } -# ALIAS_PREVIEW=true pins this deploy to the stable bisect/inspection URL -# preview-maze.ryankelly.dev. Preview-only by design: production already has its own -# alias, and pinning a prod deploy here would silently repurpose the bisect URL. -if ($env:ALIAS_PREVIEW -eq 'true') { +# Alias preview slot if slot is specified (e.g. p1.maze.ryankelly.dev) +if ($slot) { + $aliasDomain = "p$slot.maze.ryankelly.dev" + vercel alias set $url $aliasDomain --token=$env:VERCEL_TOKEN + Write-Host "DEPLOY_ALIAS=https://$aliasDomain" +} elseif ($env:ALIAS_PREVIEW -eq 'true') { + # ALIAS_PREVIEW=true pins this deploy to preview-maze.ryankelly.dev if ($target -ne 'preview') { throw "alias_preview=true is only valid with deploy_target=preview (got $target)." } diff --git a/.github/workflows/web-export.yml b/.github/workflows/web-export.yml index f189c23..1846b2a 100644 --- a/.github/workflows/web-export.yml +++ b/.github/workflows/web-export.yml @@ -22,7 +22,7 @@ name: Web Export & Deploy on: push: - branches: [main] + branches: [main, "slot/*"] paths: - "scripts/**" - "scenes/**" @@ -47,6 +47,12 @@ on: default: "preview" type: choice options: ["preview", "production"] + slot: + description: "Preview slot (1..3) to alias this deployment (e.g. 1 -> p1.maze.ryankelly.dev)" + required: false + default: "" + type: choice + options: ["", "1", "2", "3"] godot_fork_tag: description: "Override patched-editor release tag (blank = .github/web-toolchain.env)" required: false @@ -112,6 +118,7 @@ jobs: GIT_REF: ${{ github.ref }} IN_TARGET: ${{ github.event.inputs.deploy_target }} ALIAS_PREVIEW: ${{ github.event.inputs.alias_preview }} + SLOT_NUMBER: ${{ github.event.inputs.slot }} BUILD_COMMIT: ${{ steps.export.outputs.build_commit }} run: '& "$env:GITHUB_WORKSPACE/.github/scripts/deploy-vercel.ps1"' @@ -262,6 +269,7 @@ jobs: # commandeer the stable preview-maze.ryankelly.dev bisect alias. IN_TARGET: "preview" ALIAS_PREVIEW: "false" + SLOT_NUMBER: "" EVENT_NAME: ${{ github.event_name }} GIT_REF: ${{ github.ref }} BUILD_COMMIT: ${{ steps.export.outputs.build_commit }} From 44eca99582bb860b87cd241e483456c88985ad0a Mon Sep 17 00:00:00 2001 From: Ryan Kelly <94ryan.kelly@gmail.com> Date: Wed, 2 Sep 2026 09:34:54 +0100 Subject: [PATCH 2/2] feat(ci): remove legacy preview alias in favor of p1..p3 slots --- .github/scripts/deploy-vercel.ps1 | 9 +-------- .github/workflows/web-export.yml | 7 ------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/scripts/deploy-vercel.ps1 b/.github/scripts/deploy-vercel.ps1 index cb9eddb..e89ab1d 100644 --- a/.github/scripts/deploy-vercel.ps1 +++ b/.github/scripts/deploy-vercel.ps1 @@ -6,7 +6,7 @@ # docs/WEB_EXPORT.md. # # Inputs (environment): -# EVENT_NAME, GIT_REF, IN_TARGET (blank = preview), ALIAS_PREVIEW, SLOT_NUMBER, BUILD_COMMIT, VERCEL_TOKEN +# EVENT_NAME, GIT_REF, IN_TARGET (blank = preview), SLOT_NUMBER, BUILD_COMMIT, VERCEL_TOKEN Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' @@ -41,13 +41,6 @@ if ($slot) { $aliasDomain = "p$slot.maze.ryankelly.dev" vercel alias set $url $aliasDomain --token=$env:VERCEL_TOKEN Write-Host "DEPLOY_ALIAS=https://$aliasDomain" -} elseif ($env:ALIAS_PREVIEW -eq 'true') { - # ALIAS_PREVIEW=true pins this deploy to preview-maze.ryankelly.dev - if ($target -ne 'preview') { - throw "alias_preview=true is only valid with deploy_target=preview (got $target)." - } - vercel alias set $url preview-maze.ryankelly.dev --token=$env:VERCEL_TOKEN - Write-Host "DEPLOY_ALIAS=https://preview-maze.ryankelly.dev" } "url=$url" >> $env:GITHUB_OUTPUT diff --git a/.github/workflows/web-export.yml b/.github/workflows/web-export.yml index 1846b2a..454ee93 100644 --- a/.github/workflows/web-export.yml +++ b/.github/workflows/web-export.yml @@ -61,11 +61,6 @@ on: description: "Override export-template folder name (blank = .github/web-toolchain.env)" required: false default: "" - alias_preview: - description: "Alias this deploy to preview-maze.ryankelly.dev (for bisecting old commits without touching prod)" - type: boolean - required: false - default: false issue_comment: types: [created] @@ -117,7 +112,6 @@ jobs: EVENT_NAME: ${{ github.event_name }} GIT_REF: ${{ github.ref }} IN_TARGET: ${{ github.event.inputs.deploy_target }} - ALIAS_PREVIEW: ${{ github.event.inputs.alias_preview }} SLOT_NUMBER: ${{ github.event.inputs.slot }} BUILD_COMMIT: ${{ steps.export.outputs.build_commit }} run: '& "$env:GITHUB_WORKSPACE/.github/scripts/deploy-vercel.ps1"' @@ -268,7 +262,6 @@ jobs: # ALIAS_PREVIEW likewise: a /preview gets its own throwaway URL and must not # commandeer the stable preview-maze.ryankelly.dev bisect alias. IN_TARGET: "preview" - ALIAS_PREVIEW: "false" SLOT_NUMBER: "" EVENT_NAME: ${{ github.event_name }} GIT_REF: ${{ github.ref }}