From 4369d15cec6a77d7d9aa1139e18f33e83c164ff8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 15:39:03 +0000 Subject: [PATCH] Add first_deploy dispatch input so the first Cloudflare deploy can bootstrap The domain answers 403 (error 1014) until the Pages project exists, which made the carry-over fetch abort the very deploy that would create it. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01JdMNbY5hLR7FjtfEE712xG --- .github/scripts/stage-pages-site.sh | 9 +++++++++ .github/workflows/ci.yml | 7 +++++++ .github/workflows/release.yml | 7 +++++++ README.md | 2 ++ 4 files changed, 25 insertions(+) diff --git a/.github/scripts/stage-pages-site.sh b/.github/scripts/stage-pages-site.sh index 7ef431d..13fa60e 100755 --- a/.github/scripts/stage-pages-site.sh +++ b/.github/scripts/stage-pages-site.sh @@ -25,6 +25,15 @@ cp "$apk" "$out/$channel/ProLibertateGames.apk" jq -n --arg tag "$tag" --arg name "$name" --arg ch "$channel" --arg url "$base/$channel/$name" \ '{tag: $tag, apkName: $name, apkUrl: $url, channel: $ch}' > "$out/$channel/latest.json" +# PLG_SKIP_OTHER=1 is for the very first deploy, when the site does not exist +# yet and the domain answers 403 (Cloudflare error 1014) instead of 404. +if [ -n "${PLG_SKIP_OTHER:-}" ]; then + echo "PLG_SKIP_OTHER set; not carrying over $other." + rm -rf "$out/$other" + find "$out" -type f | sort + exit 0 +fi + # Carry the other channel over. 404 means it was never published; any other # failure must stop the deploy rather than silently dropping that channel. code="$(curl -sS -o "$out/$other/latest.json" -w '%{http_code}' "$base/$other/latest.json" || true)" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 237edcc..d41f320 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,11 @@ on: pull_request: branches: [ main, dev ] workflow_dispatch: + inputs: + first_deploy: + description: "First Cloudflare deploy: skip carrying over the other channel (the site does not exist yet)" + type: boolean + default: false # Needed to publish the dev-channel prerelease below. permissions: @@ -162,6 +167,8 @@ jobs: path: staged - name: Assemble site + env: + PLG_SKIP_OTHER: ${{ inputs.first_deploy && '1' || '' }} run: .github/scripts/stage-pages-site.sh dev "${{ needs.build.outputs.version }}" "staged/ProLibertateGames-${{ needs.build.outputs.version }}.apk" - name: Deploy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bedfa2a..91260c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,11 @@ on: push: branches: [ main ] workflow_dispatch: + inputs: + first_deploy: + description: "First Cloudflare deploy: skip carrying over the other channel (the site does not exist yet)" + type: boolean + default: false # Allow the built-in token to create releases and upload the APK. permissions: @@ -119,6 +124,8 @@ jobs: path: staged - name: Assemble site + env: + PLG_SKIP_OTHER: ${{ inputs.first_deploy && '1' || '' }} run: .github/scripts/stage-pages-site.sh prod "${{ needs.build.outputs.version }}" "staged/ProLibertateGames-${{ needs.build.outputs.version }}.apk" - name: Deploy diff --git a/README.md b/README.md index a87876c..cd3414f 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,8 @@ because a Pages deploy replaces everything. The two share a concurrency group so they cannot race. Needs repo secrets `CLOUDFLARE_API_TOKEN` (Account → Cloudflare Pages → Edit) and `CLOUDFLARE_ACCOUNT_ID`. Pages caps files at 25 MiB. +**First deploy:** the site does not exist yet, so the domain answers 403 (Cloudflare error 1014) and the carry-over fetch would abort. Dispatch the workflow once with `first_deploy` ticked, then attach `plg.wallacenet.ca` as a custom domain on the new `plg` Pages project. Later runs need no input. + The in-app updater reads these `latest.json` files. GitHub Releases are still published for one transition deployment so installs that predate this change can fetch it; after that, remove the GitHub release steps from both workflows.