Skip to content

Commit 3693f7d

Browse files
committed
feat(release): CI-driven publish pipeline via GitHub Actions + npm OIDC
Replace tools/release.mjs with two workflow_dispatch flows: - stable: production environment gate (Required Reviewers) + lightweight git tag. Trusted Publishing (OIDC) removes the need for an npm token. - channel beta: disposable 0.0.0-beta-<sha>-<date> versions on the corresponding dist-tag, no tag, no commit. Any collaborator can dispatch without npm credentials. Pack-time scans via publint, attw, gitleaks; weekly Dependabot for npm + actions.
1 parent 14371a0 commit 3693f7d

15 files changed

Lines changed: 625 additions & 372 deletions

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 10
8+
groups:
9+
dev-deps:
10+
dependency-type: development
11+
update-types:
12+
- minor
13+
- patch
14+
15+
- package-ecosystem: github-actions
16+
directory: /
17+
schedule:
18+
interval: weekly

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11+
12+
jobs:
13+
check:
14+
name: lint + typecheck + test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: pnpm/action-setup@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: "22"
24+
cache: pnpm
25+
26+
- run: pnpm install --frozen-lockfile
27+
28+
- run: pnpm run check
29+
30+
- run: pnpm test
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release (channel)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
channel:
7+
description: "dist-tag (kebab-case, e.g. mcp/plugin/advisor). Reserved: latest/beta/alpha/next/rc/canary/dev."
8+
required: true
9+
type: string
10+
11+
# Serialize channel releases per channel name to avoid racing tarball uploads.
12+
concurrency:
13+
group: release-channel-${{ inputs.channel }}
14+
cancel-in-progress: false
15+
16+
permissions:
17+
contents: read # no tag, no Release; just publish
18+
id-token: write # OIDC for npm Trusted Publishing + provenance
19+
20+
jobs:
21+
publish:
22+
name: publish beta to npm
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: pnpm/action-setup@v4
28+
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: "22"
32+
cache: pnpm
33+
registry-url: "https://registry.npmjs.org/"
34+
35+
- name: Install gitleaks
36+
run: |
37+
set -euo pipefail
38+
GITLEAKS_VERSION=8.21.2
39+
curl -sSfL \
40+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
41+
| sudo tar -xz -C /usr/local/bin gitleaks
42+
gitleaks version
43+
44+
- run: pnpm install --frozen-lockfile
45+
46+
- name: publish-channel
47+
run: node tools/release/publish-channel.mjs --channel "${{ inputs.channel }}"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release (stable)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
# Only one stable release at a time.
7+
concurrency:
8+
group: release-stable
9+
cancel-in-progress: false
10+
11+
permissions:
12+
contents: write # push lightweight tag to origin
13+
id-token: write # OIDC for npm Trusted Publishing + provenance
14+
15+
jobs:
16+
publish:
17+
name: publish to npm + tag
18+
runs-on: ubuntu-latest
19+
environment: production # Required Reviewers gate
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: pnpm/action-setup@v4
24+
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: "22"
28+
cache: pnpm
29+
registry-url: "https://registry.npmjs.org/"
30+
31+
- name: Install gitleaks
32+
run: |
33+
set -euo pipefail
34+
GITLEAKS_VERSION=8.21.2
35+
curl -sSfL \
36+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
37+
| sudo tar -xz -C /usr/local/bin gitleaks
38+
gitleaks version
39+
40+
- run: pnpm install --frozen-lockfile
41+
42+
- name: publish-stable
43+
run: node tools/release/publish-stable.mjs

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"dev": "pnpm -F bailian-cli-core dev",
2020
"bl": "pnpm -F bailian-cli dev",
2121
"test": "vp test",
22-
"release:check": "node tools/release.mjs check",
23-
"release:publish": "node tools/release.mjs publish",
22+
"release:check": "node tools/release/check.mjs",
2423
"wiki:crawl": "node tools/wiki-crawler/index.mjs",
2524
"test:stress": "node packages/cli/tests/stress/run.mjs"
2625
},

0 commit comments

Comments
 (0)