Skip to content

Commit 9cd4adb

Browse files
committed
refactor(release): merge stable + channel into single release.yml
npm Trusted Publishers only supports ONE (repo, workflow, environment) tuple per package, so the two split workflows cannot both be granted OIDC publish rights. Consolidate into release.yml with a mode input: - mode=stable -> publish-stable job, environment=production (reviewer gate), contents:write (push lightweight tag). - mode=channel -> publish-channel job, no environment, contents:read. Concurrency group keys on mode + channel so stable serializes globally and channels serialize per dist-tag. Trusted Publisher entry should now point at release.yml with environment left blank (matches both the production-gated stable job and the env-less channel job).
1 parent f1c78f0 commit 9cd4adb

3 files changed

Lines changed: 91 additions & 90 deletions

File tree

.github/workflows/release-channel.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/release-stable.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Release
2+
3+
# Consolidated workflow because npm Trusted Publishers only allows ONE
4+
# (repo, workflow, environment) tuple per package — so stable + channel
5+
# must share a single workflow file.
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
mode:
11+
description: "Release mode"
12+
required: true
13+
type: choice
14+
options:
15+
- stable
16+
- channel
17+
channel:
18+
description: "dist-tag for channel mode (kebab-case, e.g. mcp/plugin/advisor). Reserved: latest/beta/alpha/next/rc/canary/dev. Ignored when mode=stable."
19+
required: false
20+
type: string
21+
22+
# Serialize stable globally; serialize channel per dist-tag name.
23+
concurrency:
24+
group: release-${{ inputs.mode }}-${{ inputs.channel }}
25+
cancel-in-progress: false
26+
27+
jobs:
28+
publish-stable:
29+
if: inputs.mode == 'stable'
30+
name: publish stable to npm + tag
31+
runs-on: ubuntu-latest
32+
environment: production # Required Reviewers gate
33+
permissions:
34+
contents: write # push lightweight tag to origin
35+
id-token: write # OIDC for npm Trusted Publishing + provenance
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: pnpm/action-setup@v4
40+
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: "22"
44+
cache: pnpm
45+
registry-url: "https://registry.npmjs.org/"
46+
47+
- name: Install gitleaks
48+
run: |
49+
set -euo pipefail
50+
GITLEAKS_VERSION=8.21.2
51+
curl -sSfL \
52+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
53+
| sudo tar -xz -C /usr/local/bin gitleaks
54+
gitleaks version
55+
56+
- run: pnpm install --frozen-lockfile
57+
58+
- name: publish-stable
59+
run: node tools/release/publish-stable.mjs
60+
61+
publish-channel:
62+
if: inputs.mode == 'channel'
63+
name: publish beta to npm
64+
runs-on: ubuntu-latest
65+
permissions:
66+
contents: read # no tag, no Release; just publish
67+
id-token: write # OIDC for npm Trusted Publishing + provenance
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- uses: pnpm/action-setup@v4
72+
73+
- uses: actions/setup-node@v4
74+
with:
75+
node-version: "22"
76+
cache: pnpm
77+
registry-url: "https://registry.npmjs.org/"
78+
79+
- name: Install gitleaks
80+
run: |
81+
set -euo pipefail
82+
GITLEAKS_VERSION=8.21.2
83+
curl -sSfL \
84+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
85+
| sudo tar -xz -C /usr/local/bin gitleaks
86+
gitleaks version
87+
88+
- run: pnpm install --frozen-lockfile
89+
90+
- name: publish-channel
91+
run: node tools/release/publish-channel.mjs --channel "${{ inputs.channel }}"

0 commit comments

Comments
 (0)