From aa3402bd846f2329e781861ef731a44679e0d2da Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 2 Aug 2026 21:43:16 -0500 Subject: [PATCH] ci(release): stage prereleases from release branches Keep develop free to accept concurrent changes while Verdaccio validates an immutable release candidate. Audit dependencies and reject stable versions before publishing. Signed-off-by: Diego Resendez --- .github/workflows/stage.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index e3d2c15..3d7b42f 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -1,13 +1,12 @@ name: Stage → Verdaccio -# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub), on every merge -# to main. Publishes the package as-is — version comes from package.json (a prerelease -# like 26.7.1-beta.N) — to the internal Verdaccio under the `stg` dist-tag. This registry -# rejects overwriting an existing version, so the step unpublishes it first (a no-op on the -# first publish) then publishes fresh. +# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub) for release +# branches. Publishes the package as-is — version comes from package.json (a prerelease +# like 26.8.0-beta.N) — to the internal Verdaccio under the `stg` dist-tag. Published +# versions are immutable; fixes must increment the prerelease version. on: push: - branches: [main] + branches: ['release/**'] jobs: publish-stg: @@ -19,13 +18,17 @@ jobs: with: node-version: '22' - run: npm ci + - run: npm audit # `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) # as its own gate before anything leaves the machine. - - name: Publish to Verdaccio (unpublish + publish) + - 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") - npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true + case "$VER" in + *-*) ;; + *) echo "Refusing to stage non-prerelease version: $VER" >&2; exit 1 ;; + esac npm publish --registry https://npm.svc.zoit.services --tag stg