From cd4a9f65f6c4b401a17fe2ad770ea825bf5aa9e1 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 4 Sep 2026 08:10:17 -0500 Subject: [PATCH 1/2] ci(release): stage a tag on Gitea before it can reach production MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A `v*` tag did two things at once: `promote.yml` mirrored it to GitHub, and GitHub's `release.yml` published it to npm and JSR. Creating the tag *was* the release, so the only place to catch a bad one was a registry where npm gives 72 hours to unpublish and JSR gives nothing — a version number spent on a mistake is spent for good. The tag now means something different on each forge. On Gitea it triggers `stage.yml`, which runs the real publish path — same `prepublishOnly` gate, same tarball, same commit — against the internal Verdaccio, where a version can be overwritten. On GitHub it still publishes for real. Nothing carries the tag between them; that push is a decision made after reading the staging run. `--tags` comes off the branch push in the same change, and it is the part that mattered most. Removing the tag trigger alone would have left any tag in the runner's clone riding along with the next promotion of `main` — a production publish as a side effect of a merge, which is the exact failure the split is meant to prevent. The refusal to stage a stable version is left as it is, with a note. It will first bite at the release most worth staging, and the fix there is a suffixed staging version rather than dropping a guard that keeps a stable number from mutating under an internal consumer. Signed-off-by: Diego Resendez --- .github/workflows/promote.yml | 30 +++++++++++++++++------------- .github/workflows/stage.yml | 15 +++++++++++++-- AGENTS.md | 24 ++++++++++++++++++++---- 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 4758498..8506325 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -1,13 +1,22 @@ name: Promote → GitHub -# Promotion. Runs on GITEA ONLY. Mirrors ONLY `main` + version tags to the public GitHub -# repo — develop and feature branches stay Gitea-private (this is why we don't use Gitea's -# push-mirror, which would expose every branch). A pushed tag lands on GitHub and triggers -# its release workflow (production publish). +# Promotion. Runs on GITEA ONLY. Mirrors ONLY `main` to the public GitHub repo — develop and +# feature branches stay Gitea-private (this is why we don't use Gitea's push-mirror, which +# would expose every branch). +# +# Tags are deliberately NOT mirrored. The same `v*` tag means two different things on the two +# forges: on Gitea it stages to Verdaccio (`stage.yml`), on GitHub it publishes to npm and +# JSR, and a JSR version can never be replaced or removed. Promoting the tag is therefore a +# decision a person takes after reading the staging run, not a side effect of creating it: +# +# git push gh v +# +# `--tags` is left off the branch push for the same reason. It used to ride along here, which +# meant any tag sitting in the runner's clone could reach production as a side effect of +# promoting `main` — a publish nobody chose, of a commit nobody was looking at. on: push: branches: [main] - tags: ['v*'] jobs: push-github: @@ -16,15 +25,10 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # full history + tags for a clean push - - name: Push main + tags to GitHub + fetch-depth: 0 # full history for a clean push + - name: Push main to GitHub env: GH_TOKEN: ${{ secrets.GH_PROMOTE_TOKEN }} run: | git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/green-tea.git" - if [ "${{ github.ref_type }}" = "tag" ]; then - git push github "refs/tags/${{ github.ref_name }}" - else - git push github "HEAD:refs/heads/main" - git push github --tags - fi + git push github "HEAD:refs/heads/main" diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index 6b1bc36..3dcaacd 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -1,12 +1,18 @@ name: Stage → Verdaccio -# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub) for release -# branches. Publishes prereleases to the internal Verdaccio under the `stg` dist-tag. +# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub). Publishes to the +# internal Verdaccio under the `stg` dist-tag, from a `release/**` branch or from a `v*` tag. # Staging versions are intentionally mutable: an existing prerelease is removed before # publishing the updated release candidate under the same version. +# +# The tag trigger is what makes creating a tag on Gitea safe. It runs the real publish path — +# the same `prepublishOnly` gate, the same tarball, the same commit — against a registry we +# can overwrite, so the release is proven before the tag is promoted to GitHub, where npm +# allows 72 hours to unpublish and JSR allows nothing at all. on: push: branches: ['release/**'] + tags: ['v*'] jobs: publish-stg: @@ -32,6 +38,11 @@ jobs: run: | npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN" VER=$(node -p "require('./package.json').version") + # Staging overwrites the version it publishes, and a stable number that changes + # under an internal consumer is worse than no staging at all. This will need + # revisiting at the first stable release, which is exactly the one most worth + # staging: the answer is probably to stage it under a suffixed version rather + # than to drop the guard. case "$VER" in *-*) ;; *) echo "Refusing to stage non-prerelease version: $VER" >&2; exit 1 ;; diff --git a/AGENTS.md b/AGENTS.md index 9294f9a..1b136cb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,16 +29,19 @@ Run the first four before proposing anything as finished. The runtime suites sta ## Two forges -Development lives on a private Gitea instance. GitHub is a downstream mirror that receives `main` and release tags, nothing else. +Development lives on a private Gitea instance. GitHub is a downstream mirror that receives `main` automatically and release tags only by hand. ``` feature/* → develop → main → [promote.yml] → GitHub main - ↑ ↓ - lead dev GitHub contrib ← external PRs + ↑ │ ↓ + lead dev │ GitHub contrib ← external PRs + │ + v* tag ────┴─── Gitea: [stage.yml] → Verdaccio + └─── GitHub (pushed by hand): [release.yml] → npm + JSR ``` - **Gitea `develop`** — active development. -- **Gitea `main`** — staging. Merging here publishes nothing; only a `v*` tag publishes. +- **Gitea `main`** — staging. Merging here publishes nothing. A `v*` tag here publishes to the internal Verdaccio, never to a public registry. - **GitHub `main`** — production mirror. No human touches it. Protected against force-push and deletion, with no review requirement, because `promote.yml` pushes to it directly and a review rule would block that. - **`contrib`** — exists on *both* forges. Where outside contributions land. @@ -85,6 +88,19 @@ Bumping `package.json` and `deno.json` ahead of the tag is fine and necessary *next* publish will be called, and the docs repo's `verify:release` compares the tag against them. A version number is a plan; a changelog heading is a receipt. +**A tag is created twice, on purpose.** Pushing `v*` to Gitea stages that exact commit to +Verdaccio through the real publish path; pushing the same tag to GitHub publishes it to npm and +JSR. Nothing promotes the tag for you — `promote.yml` mirrors `main` and only `main`, so the +second push is a decision made after reading the first run: + +```bash +git push origin v # Gitea → Verdaccio, reversible +git push gh v # GitHub → npm + JSR, permanent on JSR +``` + +The split exists because a mistake caught on Verdaccio costs a re-tag, and the same mistake +caught on JSR costs the version number forever. + **After a beta release, move the channel tag by hand.** A publish sets exactly one dist-tag, and it is the only npm write the release workflow can make — Trusted Publishing's OIDC exchange lives inside `npm publish`, so the token it hands back is rejected by `npm dist-tag` (`E401`, learned the hard way -- 2.54.1 From dfe71102ca243aed915e2f3c547c3a4e42aaa357 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 4 Sep 2026 08:10:25 -0500 Subject: [PATCH 2/2] docs(changelog): date the section for the day the tag actually ships MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The heading was written for 2026-09-02, the day the cut was planned, then dated 2026-09-03 when it was closed. Neither day shipped anything, and the workflow split that has to land before the tag moved it once more. AGENTS.md is explicit that a dated heading is a receipt rather than a plan, and that this exact drift already happened once on beta.1 — a section claiming a release that did not exist, with a day of further work accumulating underneath it. Correcting the date is cheaper than being the second instance of the thing the guidance warns about. Today is the day the tag is created, so the receipt says today. Signed-off-by: Diego Resendez --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a514aa..1edf726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). green-tea uses calendar versioning: `YY.M.PATCH` — the month is not zero-padded, since npm treats versions as semver and semver forbids leading zeros. -## [26.9.0-beta.1] - 2026-09-03 +## [26.9.0-beta.1] - 2026-09-04 ### Added -- 2.54.1