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 <diego.resendez@zero-oneit.com>
52 lines
2.4 KiB
YAML
52 lines
2.4 KiB
YAML
name: Stage → Verdaccio
|
|
|
|
# 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:
|
|
if: ${{ github.server_url != 'https://github.com' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
- run: npm ci
|
|
# Same scoped gate as ci.yml: only what we ship blocks a publish. A `tsup` advisory
|
|
# reaches nobody, and holding a release candidate for one is how staging stalls on work
|
|
# that has nothing to do with the package. The full audit still reports.
|
|
- run: npm audit --omit=dev
|
|
- run: npm audit
|
|
continue-on-error: true
|
|
- name: Validate release candidate
|
|
run: npm run prepublishOnly
|
|
- name: Publish prerelease to Verdaccio
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }}
|
|
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 ;;
|
|
esac
|
|
npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true
|
|
npm publish --ignore-scripts --registry https://npm.svc.zoit.services --tag stg
|