From 33df70730bdbdc7f14c1140d46c8aeffa085e69d Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 17 Jul 2026 20:43:43 -0500 Subject: [PATCH] ci: add stage/promote/release workflows for the two-forge pipeline stage.yml (Gitea-only): publish package to Verdaccio under 'stg' tag on main merge. promote.yml (Gitea-only): mirror only main + version tags to GitHub. release.yml (GitHub-only): publish stable to npmjs on a v* tag. Forge is detected via github.server_url; secrets: VERDACCIO_TOKEN (Gitea), GH_PROMOTE_TOKEN (Gitea, set), NPM_TOKEN (GitHub, pending). Signed-off-by: Diego Resendez --- .github/workflows/promote.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ .github/workflows/stage.yml | 28 ++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .github/workflows/promote.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/stage.yml diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml new file mode 100644 index 0000000..4758498 --- /dev/null +++ b/.github/workflows/promote.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1dd85f6 --- /dev/null +++ b/.github/workflows/release.yml @@ -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_TOKEN }} + run: npm publish --access public diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml new file mode 100644 index 0000000..9b467a4 --- /dev/null +++ b/.github/workflows/stage.yml @@ -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.VERDACCIO_TOKEN }} + run: | + npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN" + npm publish --registry https://npm.svc.zoit.services --tag stg