ci(release): keep latest on the newest beta, and make a re-run finishable #58

Merged
chrnx merged 1 commits from ci/release-dist-tags into develop 2026-08-19 19:11:17 +00:00
Owner

Mientras no haya release estable, npm install @green-tea/core debe dar lo mismo que @beta. Desde 1a313c2 un prerelease se publica sólo bajo su dist-tag de canal, así que el próximo release habría dejado latest en 26.8.0-beta.0.

npm dist-tag no puede usar Trusted Publishing — el intercambio OIDC vive únicamente en publish.js. En vez de guardar un token largo en un secret para un solo comando, el paso hace el mismo intercambio: pide el id-token de Actions, lo cambia por un token corto con alcance al paquete, y mueve el tag. Ambos valores van enmascarados.

La regla está acotada: en cuanto exista una versión estable, latest le pertenece y una beta posterior no debe jalarlo hacia atrás.

Los dos publishes pasan a ser skip-si-ya-existe, porque el paso nuevo corre después y puede fallar: un re-run tiene que poder terminar el trabajo restante.

Hallazgo aparte: @green-tea/core está en JSR con 0 versiones — el paso de JSR se añadió en 91f349b (2026-08-16), después de beta.0, y nunca ha corrido. Este tag sería el primer publish a JSR. Por eso la guarda pregunta a api.jsr.io y no a jsr.io/meta.json, que da 404 para un paquete sin versiones.

Predicados verificados localmente contra los registros reales (npm ya-publicado en ambos sentidos, JSR ya-publicado contra std/path@1.0.0, y la regla de estable con ["1.0.0-beta.0","1.0.0"]).

Mientras no haya release estable, `npm install @green-tea/core` debe dar lo mismo que `@beta`. Desde `1a313c2` un prerelease se publica sólo bajo su dist-tag de canal, así que el próximo release habría dejado `latest` en 26.8.0-beta.0. `npm dist-tag` no puede usar Trusted Publishing — el intercambio OIDC vive únicamente en `publish.js`. En vez de guardar un token largo en un secret para un solo comando, el paso hace el mismo intercambio: pide el id-token de Actions, lo cambia por un token corto con alcance al paquete, y mueve el tag. Ambos valores van enmascarados. La regla está acotada: en cuanto exista una versión estable, `latest` le pertenece y una beta posterior no debe jalarlo hacia atrás. Los dos publishes pasan a ser skip-si-ya-existe, porque el paso nuevo corre después y puede fallar: un re-run tiene que poder terminar el trabajo restante. **Hallazgo aparte:** `@green-tea/core` está en JSR con **0 versiones** — el paso de JSR se añadió en `91f349b` (2026-08-16), después de beta.0, y nunca ha corrido. Este tag sería el primer publish a JSR. Por eso la guarda pregunta a `api.jsr.io` y no a `jsr.io/meta.json`, que da 404 para un paquete sin versiones. Predicados verificados localmente contra los registros reales (npm ya-publicado en ambos sentidos, JSR ya-publicado contra `std/path@1.0.0`, y la regla de estable con `["1.0.0-beta.0","1.0.0"]`).
chrnx added 1 commit 2026-08-19 19:10:15 +00:00
ci(release): keep latest on the newest beta, and make a re-run finishable
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 14s
CI / build (pull_request) Successful in 24s
CI / runtimes (edge) (pull_request) Successful in 12s
CI / runtimes (deno) (pull_request) Successful in 19s
7be26fda5c
While there is no stable release, a bare `npm install @green-tea/core` should
get the same thing `@beta` gets — that is what the docs promise. Since
`1a313c2` a prerelease publishes under its channel tag only, so the next
release would have left `latest` behind on 26.8.0-beta.0: an older build for
anyone who installs without asking for a channel.

`npm publish` sets one tag, and `npm dist-tag` cannot use Trusted Publishing —
the OIDC exchange lives inside `publish.js` and nowhere else. Rather than keep
a long-lived npm token in a secret for one command, the step runs the same
exchange itself: request the Actions id-token, trade it for a short-lived
package-scoped token, move the tag. Both values are masked.

The rule is bounded on purpose. Once a stable version exists it owns `latest`
permanently, and a beta published afterwards must not drag it backwards; the
lookup that decides this is read into a variable first, so a failed request
fails the step instead of passing for "no stable exists".

Both publishes also become skip-if-present. That is not belt-and-braces: the
new step runs after them and can fail, so a re-run has to be able to finish
the remaining work instead of dying on a version npm would reject anyway. The
JSR guard asks api.jsr.io rather than jsr.io/meta.json, which is 404 for a
package with no versions yet — the state this package is actually in.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx merged commit 7f9e6b19d6 into develop 2026-08-19 19:11:17 +00:00
Sign in to join this conversation.