ci: stage/promote/release workflows (two-forge pipeline) #4

Merged
chrnx merged 2 commits from feat/ci-publish-workflows into develop 2026-07-18 02:18:30 +00:00
3 changed files with 84 additions and 0 deletions

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
name: Promote → GitHub
# Promotion. Runs on GITEA ONLY. Mirrors ONLY `main` + version tags to the public GitHub
# repo — develop and feature branches stay Gitea-private (this is why we don't use Gitea's
# push-mirror, which would expose every branch). A pushed tag lands on GitHub and triggers
# its release workflow (production publish).
on:
push:
branches: [main]
tags: ['v*']
jobs:
push-github:
if: ${{ github.server_url != 'https://github.com' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history + tags for a clean push
- name: Push main + tags to GitHub
env:
GH_TOKEN: ${{ secrets.GH_PROMOTE_TOKEN }}
run: |
git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/green-tea.git"
if [ "${{ github.ref_type }}" = "tag" ]; then
git push github "refs/tags/${{ github.ref_name }}"
else
git push github "HEAD:refs/heads/main"
git push github --tags
fi
+26
View File
@@ -0,0 +1,26 @@
name: Release → npmjs
# Production publish. Runs on GITHUB ONLY, on a version tag (`v*`). Publishes the stable
# package (version from package.json) to the public npmjs registry under `latest`.
# The tag arrives via the promote workflow; the version should be stable (no prerelease)
# before tagging.
on:
push:
tags: ['v*']
jobs:
publish-prod:
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'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
# `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) first.
- name: Publish to npmjs
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }}
run: npm publish --access public
+28
View File
@@ -0,0 +1,28 @@
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-stg.N) — to the internal Verdaccio under the `stg` dist-tag. Verdaccio
# allows overwrite, so re-publishing the same version is a no-op-ish refresh.
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
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }}
run: |
npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN"
npm publish --registry https://npm.svc.zoit.services --tag stg