|
| 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