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