CI: publish every push to the staging registry

main → latest (the package.json version, skipped if already published), next → next,
other branches → dev-<branch> as <version>-<tag>.<timestamp> prereleases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qxbkp4tA7G5SCWjzWuxmE
This commit is contained in:
Claude
2026-10-23 13:43:51 +00:00
parent 631c75428b
commit ad517965ee
3 changed files with 69 additions and 1 deletions
+27 -1
View File
@@ -2,9 +2,12 @@ name: CI
on:
push:
branches: [main]
branches: ['**'] # not tags
pull_request:
env:
NPM_REGISTRY: https://verdaccio.harvmaster.com/
jobs:
check:
name: Node ${{ matrix.node }}
@@ -28,3 +31,26 @@ jobs:
run: npm run test:only
- name: Build
run: npm run build
# Pushes only (not pull requests): main → `latest`, next → `next`, other branches → `dev-<branch>`.
# See scripts/publish.mjs. Needs the NPM_REGISTRY_TOKEN secret.
staging:
name: Publish to staging registry
needs: check
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Configure registry
run: |
host="${NPM_REGISTRY#https://}"
printf 'registry=%s\n//%s:_authToken=${NPM_REGISTRY_TOKEN}\n' "$NPM_REGISTRY" "$host" > .npmrc
- name: Publish
run: node scripts/publish.mjs "${{ github.ref_name }}"
env:
NPM_REGISTRY_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}