Files
core/.github/workflows/stage.yml
T
chrnx 3fe0016dbd
CI / build (pull_request) Successful in 24s
fix(ci): unpublish before publish to Verdaccio (registry rejects overwrite)
The staging registry (npm.svc.zoit.services) does not allow overwriting an existing version, so re-publishing the same prerelease on each main merge failed. Unpublish the version first (tolerant --force, no-op when absent) then publish fresh.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-18 14:08:39 -05:00

32 lines
1.3 KiB
YAML

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.
on:
push:
branches: [main]
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
# `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build)
# as its own gate before anything leaves the machine.
- name: Publish to Verdaccio (unpublish + publish)
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
npm publish --registry https://npm.svc.zoit.services --tag stg