From 3293754c8f92f963852a50866427e3be4291452d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 17:05:11 +0000 Subject: [PATCH] Run the pub.dev publish job in the pub.dev environment The re-run of the extensions-v0.8.1 publish got past the tag check (the pub.dev tag pattern now matches extensions-v{{version}}) and failed on the next one: The calling GitHub Action is not allowed to publish, because: publishing is configured to only be allowed from actions with an environment, this token originates from an action running in environment 'null' pub.dev's automated-publishing settings require the `pub.dev` GitHub Actions environment, and the publish job declared none. pub.dev checks the tag pattern before the environment, so this requirement was hidden behind the earlier tag mismatch. The job now declares `environment: pub.dev`; GitHub creates the environment on the first run that names it. Header updated to match: * Lists the environment requirement next to the tag patterns in the one-time pub.dev setup, and warns that a "protected branches only" deployment rule on the environment would refuse every tag-triggered run. * Drops the "if the flutter publish races ahead, re-run it" advice, stale since auto-tag.yml started waiting for extensions to reach pub.dev before pushing the extensions_flutter tag. * Notes that a tag-triggered run uses the workflow as of the tagged commit, so "Re-run failed jobs" picks up a pub.dev-side fix but never a fix to this file. That is the case right now: extensions-v0.8.1 points at adbe895, which has the old workflow, so the tag has to be deleted and re-created at main (re-running auto-tag.yml does that) after this merges. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01K3TbUE73aGPvFr1vqBLQbf --- .github/workflows/publish.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 88c5dd5..a06cf74 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,11 +7,23 @@ # repository: jamiewest/extensions # tag pattern: extensions-v{{version}} (extensions) # tag pattern: extensions_flutter-v{{version}} (extensions_flutter) +# require GitHub Actions environment: pub.dev (both) +# +# The environment name must match the `environment:` on the job below, or +# pub.dev refuses the token ("running in environment 'null'"). GitHub creates +# the pub.dev environment on the first run that names it. If you add +# deployment rules to it, allow the release tags: a "protected branches only" +# rule refuses every tag-triggered run. # # Tags are normally pushed automatically by auto-tag.yml when a version bump # lands on main; pushing a tag by hand works the same way. When both packages -# bump, extensions publishes first (extensions_flutter depends on it) — if -# the flutter publish races ahead and fails on the unpublished dep, re-run it. +# bump, auto-tag.yml pushes the extensions_flutter tag only once extensions is +# live on pub.dev, since extensions_flutter depends on it. +# +# A tag-triggered run uses this file as of the TAGGED commit. "Re-run failed +# jobs" therefore picks up a fix made on pub.dev, but not a fix to this +# workflow: for that, delete the tag and re-run auto-tag.yml, which re-creates +# it at the current main. name: Publish to pub.dev @@ -25,6 +37,8 @@ jobs: publish: runs-on: ubuntu-latest timeout-minutes: 15 + # Must match "Require GitHub Actions environment" on pub.dev — see header. + environment: pub.dev permissions: id-token: write # required for pub.dev OIDC token exchange steps: