Skip to content

Commit 1227efd

Browse files
build: Release npm libraries without per-package workflow edits
- `.craft.yml` declares the standalone libraries once, as the `packages/{http,logger}` workspace key. - `merge-jobs.yml` lists the Craft workspaces that use the default artifact provider (`scripts/npm-library-workspaces.mjs`), packs each in a parallel matrix job, and merges the tarballs into the artifact named after the commit. It runs on every release branch but the CLI's. - `release.yml` takes any directory under `packages/` as the product and passes it to Craft, which rejects names that are not workspaces. Publishing another package now needs only its name in `.craft.yml`. Also releases `@sentry/http` under MIT, with 1.0.0 as its first version.
1 parent 8f0485f commit 1227efd

11 files changed

Lines changed: 225 additions & 176 deletions

File tree

‎.craft.yml‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,12 @@ workspaces:
133133
assert_match version.to_s, shell_output("#{bin}/sentry --version").chomp
134134
end
135135
end
136-
# No preReleaseCommand: Craft bumps package.json through the npm target.
137-
packages/http:
138-
changelog:
139-
policy: auto
140-
releaseBranchPrefix: "release/{{workspaceName}}"
141-
targets:
142-
- name: github
143-
tagPrefix: "{{workspaceName}}@"
144-
includeNames: '/^{{packageSimpleName}}-\d.*\.tgz$/'
145-
- name: npm
146-
includeNames: '/^{{packageSimpleName}}-\d.*\.tgz$/'
147-
packages/logger:
136+
# Standalone npm libraries. Each is released on its own, with
137+
# `<name>@<version>` tags and `release/<name>/<version>` branches, and
138+
# `merge-jobs.yml` packs every one of them. To publish another package
139+
# from `packages/`, add its directory name here. No preReleaseCommand:
140+
# Craft bumps package.json through the npm target.
141+
packages/{http,logger}:
148142
changelog:
149143
policy: auto
150144
releaseBranchPrefix: "release/{{workspaceName}}"

‎.github/workflows/merge-jobs.yml‎

Lines changed: 90 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,125 @@ name: Post-merge tasks
22

33
on:
44
push:
5-
branches: ["main", "release/*", "release/http/**", "release/logger/**"]
5+
# The CLI's release branches are built by cli-build.yml.
6+
branches: ["main", "release/**", "!release/cli/**"]
67
workflow_dispatch:
78

9+
permissions:
10+
contents: read
11+
812
jobs:
9-
build-publish:
13+
test:
1014
runs-on: ubuntu-latest
1115

1216
steps:
1317
- name: Checkout
14-
uses: actions/checkout@v4
18+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
19+
with:
20+
persist-credentials: false
1521

1622
- name: Setup pnpm
1723
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
1824

1925
- name: Set up Node
20-
uses: actions/setup-node@v4
26+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2127
with:
2228
node-version-file: "package.json"
23-
cache: "pnpm"
2429

2530
- name: Install dependencies
2631
run: pnpm install
2732

2833
- name: Build
29-
run: pnpm --filter '@sentry/mcp-core...' --filter @sentry/http --filter @sentry/logger --if-present run build
34+
run: pnpm --filter '@sentry/mcp-core...' --filter @sentry/logger --if-present run build
3035

3136
- name: Run linter
3237
run: pnpm lint
3338

3439
- name: Run tests
3540
run: pnpm test:ci
3641

37-
- name: Package http
38-
working-directory: packages/http
39-
run: pnpm pack --pack-destination dist
40-
41-
- name: Package logger
42-
working-directory: packages/logger
43-
run: pnpm pack --pack-destination dist
44-
45-
- name: Archive artifacts
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: ${{ github.sha }}
49-
path: |
50-
${{ github.workspace }}/packages/http/dist/*.tgz
51-
${{ github.workspace }}/packages/logger/dist/*.tgz
52-
5342
- name: Publish Test Report
5443
uses: mikepenz/action-junit-report@cf701569b05ccdd861a76b8607a66d76f6fd4857
5544
if: ${{ !cancelled() }}
5645
with:
5746
report_paths: "**/*.junit.xml"
5847
comment: false
48+
49+
# Every Craft workspace without its own artifact provider is an npm
50+
# library whose tarball this workflow builds.
51+
discover-packages:
52+
runs-on: ubuntu-latest
53+
outputs:
54+
matrix: ${{ steps.packages.outputs.matrix }}
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
59+
with:
60+
persist-credentials: false
61+
62+
- name: Set up Node
63+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
64+
with:
65+
node-version-file: "package.json"
66+
67+
# The same major version as release.yml's getsentry/craft@v3.
68+
- name: Install Craft
69+
run: npm install --global @sentry/craft@3 # zizmor: ignore[adhoc-packages]
70+
71+
- name: List packages
72+
id: packages
73+
run: node scripts/npm-library-workspaces.mjs
74+
75+
package:
76+
needs: discover-packages
77+
runs-on: ubuntu-latest
78+
strategy:
79+
matrix: ${{ fromJSON(needs.discover-packages.outputs.matrix) }}
80+
name: Package ${{ matrix.name }}
81+
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
85+
with:
86+
persist-credentials: false
87+
88+
- name: Setup pnpm
89+
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
90+
91+
- name: Set up Node
92+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
93+
with:
94+
node-version-file: "package.json"
95+
96+
- name: Install dependencies
97+
run: pnpm install
98+
99+
- name: Build
100+
env:
101+
WORKSPACE: ${{ matrix.workspace }}
102+
run: pnpm --filter "{./$WORKSPACE}..." --if-present run build
103+
104+
- name: Package
105+
working-directory: ${{ matrix.workspace }}
106+
run: pnpm pack --pack-destination dist
107+
108+
- name: Upload tarball
109+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
110+
with:
111+
name: npm-${{ matrix.name }}
112+
path: ${{ matrix.workspace }}/dist/*.tgz
113+
if-no-files-found: error
114+
115+
# Craft reads every tarball from one artifact named after the commit.
116+
archive:
117+
needs: [test, package]
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- name: Archive artifacts
122+
uses: actions/upload-artifact/merge@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
123+
with:
124+
name: ${{ github.sha }}
125+
pattern: npm-*
126+
delete-merged: true

‎.github/workflows/release.yml‎

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ on:
44
workflow_dispatch:
55
inputs:
66
product:
7-
description: Product to release
7+
description: "Package to release: a directory under packages/ with a .craft.yml workspace, such as cli, http, or logger"
88
required: true
9-
type: choice
9+
type: string
1010
default: cli
11-
options:
12-
- cli
13-
- http
14-
- logger
1511
bump:
1612
description: "Version bump: auto (from commits), pre (next prerelease), or an explicit bump type"
1713
required: true
@@ -62,37 +58,15 @@ jobs:
6258
with:
6359
run_install: false
6460

65-
- name: Resolve release workspace
66-
id: release
67-
env:
68-
PRODUCT: ${{ inputs.product }}
69-
run: |
70-
# Each product maps to a `.craft.yml` workspace. The `cli` release
71-
# also publishes @sentry/mcp-server at the same version.
72-
case "$PRODUCT" in
73-
cli)
74-
workspace=packages/cli
75-
;;
76-
http)
77-
workspace=packages/http
78-
;;
79-
logger)
80-
workspace=packages/logger
81-
;;
82-
*)
83-
echo "::error::Unsupported product: $PRODUCT"
84-
exit 1
85-
;;
86-
esac
87-
88-
echo "workspace=$workspace" >> "$GITHUB_OUTPUT"
89-
9061
- name: Prepare release
9162
uses: getsentry/craft@v3
9263
env:
9364
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
9465
with:
95-
workspace: ${{ steps.release.outputs.workspace }}
66+
# Craft fails, listing the workspaces it has, for any other name.
67+
# The `cli` release also publishes @sentry/mcp-server at the same
68+
# version.
69+
workspace: packages/${{ inputs.product }}
9670
# An exact version wins over the bump. Craft bumps from the
9771
# workspace's latest release tag, or from its package.json version
9872
# before the first tag.

‎docs/operations/github-actions.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,22 @@ token pushes the branch and opens the PR, so `test.yml` runs on it.
154154
branch by hand are lost.
155155
- The PR is never merged automatically.
156156

157+
### release.yml and merge-jobs.yml
158+
159+
`release.yml` prepares a release of one package with Craft. Its `product` input
160+
is a directory under `packages/`, such as `cli`, `http`, or `logger`, and Craft
161+
fails for a directory that has no `.craft.yml` workspace.
162+
163+
`merge-jobs.yml` runs on `main` and on every release branch except the CLI's.
164+
It lists the Craft workspaces that use the default artifact provider with
165+
`scripts/npm-library-workspaces.mjs`, packs each one in a parallel matrix job,
166+
and merges the tarballs into the artifact named after the commit, where Craft
167+
reads them. The CLI sets its own artifact provider and is built by
168+
`cli-build.yml`.
169+
170+
To publish another package from `packages/`, add its directory name to the
171+
`packages/{...}` workspace key in `.craft.yml`. Neither workflow needs a change.
172+
157173
## Package CI checks
158174

159175
Add a check for one workspace package to that package's `package.json`, not to

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"scripts": {
2525
"docs:check": "node scripts/check-doc-links.mjs",
26-
"test:ci-projects": "node --test scripts/ci-projects.test.mjs scripts/check-workspace-deps.test.mjs scripts/cli-nightly-version.test.mjs scripts/cli-nightly-watchdog.test.mjs scripts/platform-setup-pr.test.mjs scripts/codemod-version-changed.test.mjs scripts/cloudflare-deployment.test.mjs scripts/deploy-workflow.test.mjs scripts/migrate-cloudflare-token.test.mjs scripts/oxc-config.test.mjs scripts/cli-lint-rules.test.mjs scripts/workflow-policy.test.mjs scripts/tsconfig-policy.test.mjs",
26+
"test:ci-projects": "node --test scripts/ci-projects.test.mjs scripts/check-workspace-deps.test.mjs scripts/cli-nightly-version.test.mjs scripts/cli-nightly-watchdog.test.mjs scripts/platform-setup-pr.test.mjs scripts/codemod-version-changed.test.mjs scripts/npm-library-workspaces.test.mjs scripts/cloudflare-deployment.test.mjs scripts/deploy-workflow.test.mjs scripts/migrate-cloudflare-token.test.mjs scripts/oxc-config.test.mjs scripts/cli-lint-rules.test.mjs scripts/workflow-policy.test.mjs scripts/tsconfig-policy.test.mjs",
2727
"dev": "pnpm --filter '@sentry/mcp-cloudflare...' --if-present run build && dotenv -e .env -e .env.local -- pnpm --parallel --filter @sentry/mcp-cloudflare --filter @sentry/mcp-core --filter @sentry/mcp-server-mocks --if-present run dev",
2828
"dev:stdio": "pnpm --filter '@sentry/mcp-core...' --if-present run build 1>&2 && dotenv -e .env -e .env.local -- pnpm --silent --dir packages/cli run cli mcp",
2929
"build": "dotenv -e .env -e .env.local -- pnpm -r --filter '!sentry' --filter '!sentry-cli-docs' --if-present run build",

‎packages/http/LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Functional Software, Inc. dba Sentry
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎packages/http/LICENSE.md‎

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

‎packages/http/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,4 @@ const request = withRetry(
168168

169169
## License
170170

171-
[FSL-1.1-Apache-2.0](LICENSE.md)
171+
[MIT](LICENSE)

0 commit comments

Comments
 (0)