Skip to content

Commit 26152b2

Browse files
committed
ci(release): publish to GitHub Packages only; document manual npmjs
Drop npmjs automation and NPM_TOKEN. Tag workflow publishes @rethunk-ai/mcp-multi-root-git to npm.pkg.github.com (ephemeral package.json patch for required org scope), keeps GitHub Release tarball from @rethunk name. HUMANS/install/README/AGENTS describe GPR vs manual npm publish.
1 parent f7ed053 commit 26152b2

File tree

5 files changed

+72
-20
lines changed

5 files changed

+72
-20
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
runs-on: ubuntu-latest
1515
permissions:
1616
contents: write
17+
packages: write
1718
steps:
1819
- uses: actions/checkout@v6
1920

2021
- uses: actions/setup-node@v6
2122
with:
2223
node-version: "24"
23-
registry-url: "https://registry.npmjs.org"
2424

2525
- uses: oven-sh/setup-bun@v2
2626
with:
@@ -58,10 +58,26 @@ jobs:
5858
npm pack
5959
echo "tarball=$(ls -t rethunk-mcp-multi-root-git-*.tgz | head -1)" >> "$GITHUB_OUTPUT"
6060
61-
- name: Publish to npm
62-
run: npm publish --access public
61+
- name: Publish to GitHub Packages (npm registry)
6362
env:
64-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
set -euo pipefail
66+
node <<'NODE'
67+
const fs = require("node:fs");
68+
const p = JSON.parse(fs.readFileSync("package.json", "utf8"));
69+
p.name = "@rethunk-ai/mcp-multi-root-git";
70+
p.publishConfig = {
71+
registry: "https://npm.pkg.github.com",
72+
access: "public",
73+
};
74+
fs.writeFileSync("package.json", JSON.stringify(p, null, 2) + "\n");
75+
NODE
76+
{
77+
echo "@rethunk-ai:registry=https://npm.pkg.github.com"
78+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}"
79+
} > .npmrc
80+
npm publish --access public
6581
6682
- name: Create GitHub Release (official gh CLI, no third-party action)
6783
env:

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
## Validation and CI
3636

37-
Local: `bun run build` (`rimraf dist && tsc`), `bun run check` (Biome), `bun run test` (`bun test` for [`src/repo-paths.test.ts`](src/repo-paths.test.ts)). GitHub Actions runs the same after `bun install --frozen-lockfile` on PRs and `main` ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)), then uploads a **prerelease `npm pack` artifact**. Pushes of tag **`v*.*.*`** matching `package.json` `version` run [`.github/workflows/release.yml`](.github/workflows/release.yml) (npm publish + GitHub Release); see [HUMANS.md](HUMANS.md) Publishing.
37+
Local: `bun run build` (`rimraf dist && tsc`), `bun run check` (Biome), `bun run test` (`bun test` for [`src/repo-paths.test.ts`](src/repo-paths.test.ts)). GitHub Actions runs the same after `bun install --frozen-lockfile` on PRs and `main` ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)), then uploads a **prerelease `npm pack` artifact**. Pushes of tag **`v*.*.*`** matching `package.json` `version` run [`.github/workflows/release.yml`](.github/workflows/release.yml) (**GitHub Packages** npm publish under **`@rethunk-ai/mcp-multi-root-git`** + **GitHub Release** with tarball); **npmjs** is manual only — see [HUMANS.md](HUMANS.md) Publishing.
3838

3939
Optional [`.githooks/`](.githooks): run **`bun run setup-hooks`** once per clone (`core.hooksPath``.githooks`). **pre-commit** = `check`; **pre-push** = frozen install + build + check. See [HUMANS.md](HUMANS.md) Development.
4040

HUMANS.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ With **multiple MCP file roots**, the server picks a root whose git toplevel def
4343
}
4444
```
4545

46+
If you installed from **GitHub Packages**, use **`./node_modules/@rethunk-ai/mcp-multi-root-git/git-mcp-presets.schema.json`** in **`$schema`** instead (see [docs/install.md](docs/install.md#github-packages)).
47+
4648
**Layouts:**
4749

4850
1. **Wrapped (recommended):** `{ "schemaVersion": "1", "presets": { "<name>": { ... } } }`.
@@ -90,22 +92,24 @@ bun run setup-hooks # once per clone: use .githooks (pre-commit: check; pre-pu
9092

9193
## Publishing
9294

93-
### npm (production) — version tags only
95+
### GitHub (automated) — version tags only
9496

95-
Releases to [npmjs](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git) are automated by [`.github/workflows/release.yml`](.github/workflows/release.yml) when you push a **semver git tag** `vX.Y.Z` that **exactly matches** `version` in `package.json` (e.g. tag `v1.2.3` and `"version": "1.2.3"`).
97+
Tag pushes run [`.github/workflows/release.yml`](.github/workflows/release.yml): build, check, tests, then:
9698

97-
1. Bump **`package.json` `version`**, commit on `main`.
98-
2. Create and push the tag: `git tag vX.Y.Z && git push origin vX.Y.Z`
99+
1. **`npm pack`** using the committed **`package.json`** name [`@rethunk/mcp-multi-root-git`](https://github.com/Rethunk-AI/mcp-multi-root-git) — tarball attached to a **GitHub Release** for that tag.
100+
2. **GitHub Packages** (npm registry): the workflow temporarily rewrites the package **name** to **`@rethunk-ai/mcp-multi-root-git`** (required scope for org `Rethunk-AI` on GitHub) and runs **`npm publish`** to **`https://npm.pkg.github.com`** with **`GITHUB_TOKEN`** (`packages: write`). No npmjs token is used in CI.
99101

100-
The workflow runs build, check, and tests, publishes with **`npm publish`**, then creates a **GitHub Release** for that tag and attaches the same **`.tgz`** as a downloadable asset.
102+
Prerequisite: push a **semver git tag** `vX.Y.Z` that **exactly matches** `version` in `package.json` (e.g. `v1.2.3` and `"version": "1.2.3"`).
101103

102-
**Repository secret:** add **`NPM_TOKEN`** (granular npm access token with publish permission for `@rethunk/mcp-multi-root-git` or the scope). Without it, the publish step fails.
104+
### npmjs (manual) — maintainers only
103105

104-
### Local publish (maintainers)
106+
npmjs no longer fits an unattended CI publish flow for this org; **do not** rely on automation to [npmjs](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git). To publish the **same** package name consumers already use (**`@rethunk/mcp-multi-root-git`**):
105107

106-
```bash
107-
bun run prepublishOnly # build + check + test
108-
bun publish
109-
```
108+
1. On a clean checkout at the release commit (usually **`main`** after bumping version), run **`bun run prepublishOnly`** (or `bun run build && bun run check && bun run test`).
109+
2. Log in to the public registry once per machine: **`npm login`** (or `npm adduser`) so **`npm whoami`** shows the account that owns **`@rethunk`** on npmjs.
110+
3. Ensure **`package.json`** still has **`"name": "@rethunk/mcp-multi-root-git"`** and **`publishConfig.access`** is **`"public"`** (no **`publishConfig.registry`** pointing at GitHub — leave default registry for npmjs).
111+
4. Publish: **`npm publish --access public`** (runs **`prepublishOnly`** again unless you pass **`--ignore-scripts`** after you already verified locally).
112+
113+
**`package.json` `files`** must keep the whole **`dist/`** directory so every emitted chunk the entry imports is packed; if you add new `src/server/*.ts` modules, `tsc` emits matching **`dist/server/*.js`** files — do not narrow **`files`** back to a single **`server.js`** or installs break.
110114

111-
`npm publish` works if `dist/` is built and checks pass. **`package.json` `files` includes the whole `dist/` directory** so every emitted chunk the entry imports is packed; if you add new `src/server/*.ts` modules, `tsc` will emit matching `dist/server/*.js` files—do not narrow `files` back to a single `server.js` or installs will break.
115+
**Preset `$schema`:** after **`npm install`**, the schema path is under **`node_modules/@rethunk/mcp-multi-root-git/`** for npmjs, or **`node_modules/@rethunk-ai/mcp-multi-root-git/`** when installing from GitHub Packages — adjust **`$schema`** accordingly (see [docs/install.md](docs/install.md)).

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
[![CI](https://github.com/Rethunk-AI/mcp-multi-root-git/actions/workflows/ci.yml/badge.svg)](https://github.com/Rethunk-AI/mcp-multi-root-git/actions/workflows/ci.yml)
44
[![Release](https://github.com/Rethunk-AI/mcp-multi-root-git/actions/workflows/release.yml/badge.svg)](https://github.com/Rethunk-AI/mcp-multi-root-git/actions/workflows/release.yml)
5+
[![GitHub release](https://img.shields.io/github/v/release/Rethunk-AI/mcp-multi-root-git?logo=github&label=release)](https://github.com/Rethunk-AI/mcp-multi-root-git/releases/latest)
56
[![npm version](https://img.shields.io/npm/v/%40rethunk%2Fmcp-multi-root-git.svg)](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git)
67
[![npm downloads](https://img.shields.io/npm/dm/%40rethunk%2Fmcp-multi-root-git.svg?label=npm%20downloads)](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git)
8+
[![GitHub Packages](https://img.shields.io/badge/github%20packages-%40rethunk--ai%2Fmcp--multi--root--git-24292f?logo=github)](https://github.com/Rethunk-AI/mcp-multi-root-git/pkgs/npm/mcp-multi-root-git)
79
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
810
[![Node.js](https://img.shields.io/badge/node-%3E%3D22-339933.svg)](https://github.com/Rethunk-AI/mcp-multi-root-git/blob/main/package.json)
911

1012
Read-only **git** tools over MCP (status, multi-root inventory, `HEAD` parity, presets). **Install and MCP client wiring:** **[docs/install.md](docs/install.md)** only — do not duplicate those steps elsewhere.
1113

12-
**Repository:** [github.com/Rethunk-AI/mcp-multi-root-git](https://github.com/Rethunk-AI/mcp-multi-root-git) · **npm:** [`@rethunk/mcp-multi-root-git`](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git)
14+
**Repository:** [github.com/Rethunk-AI/mcp-multi-root-git](https://github.com/Rethunk-AI/mcp-multi-root-git) · **npmjs (manual releases):** [`@rethunk/mcp-multi-root-git`](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git) · **GitHub Packages (CI on each tag):** [`@rethunk-ai/mcp-multi-root-git`](https://github.com/Rethunk-AI/mcp-multi-root-git/pkgs/npm/mcp-multi-root-git) — see [docs/install.md](docs/install.md) and [HUMANS.md](HUMANS.md) Publishing.
1315

1416
## Documentation
1517

docs/install.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This package is an MCP **stdio** server. The client starts the process and passe
77
## Table of contents
88

99
- [Prerequisites](#prerequisites)
10+
- [GitHub Packages](#github-packages)
1011
- [Ways to run the binary](#ways-to-run-the-binary)
1112
- [Configuration shape (stdio)](#configuration-shape-stdio)
1213
- [Cursor](#cursor)
@@ -22,17 +23,46 @@ This package is an MCP **stdio** server. The client starts the process and passe
2223
- **Git** on `PATH` (`git --version`). The server shells out to `git`; if it is missing, tools return `git_not_found`.
2324
- **Node.js ≥ 22** if you use **`npx`**, or **Bun** if you use **`bunx`** / **`bun`** (see `package.json` `engines` / `packageManager`).
2425

26+
## GitHub Packages
27+
28+
Every **version tag** on this repo is published to the **GitHub npm registry** as **`@rethunk-ai/mcp-multi-root-git`** (scope matches the GitHub org). The **npmjs** package name **`@rethunk/mcp-multi-root-git`** is updated **manually** by maintainers and may lag; prefer GitHub Packages for CI-aligned installs.
29+
30+
1. Create a [GitHub personal access token](https://github.com/settings/tokens) with at least **`read:packages`** (and **`repo`** if the package were private).
31+
2. In **`~/.npmrc`** or the project **`.npmrc`** (do not commit secrets):
32+
33+
```ini
34+
@rethunk-ai:registry=https://npm.pkg.github.com
35+
//npm.pkg.github.com/:_authToken=YOUR_TOKEN_HERE
36+
```
37+
38+
3. Install or run, for example:
39+
40+
```bash
41+
npx -y @rethunk-ai/mcp-multi-root-git
42+
```
43+
44+
Or **`bunx @rethunk-ai/mcp-multi-root-git`** with the same registry configuration for that scope.
45+
46+
**`$schema` in preset JSON:** point at the copy under **`node_modules/@rethunk-ai/mcp-multi-root-git/git-mcp-presets.schema.json`** when you install from GitHub Packages; use **`@rethunk/mcp-multi-root-git/...`** when installing from npmjs.
47+
2548
## Ways to run the binary
2649

27-
Use any of these from a terminal to confirm the package runs (each starts the stdio server until EOF):
50+
Use any of these from a terminal to confirm the package runs (each starts the stdio server until EOF). **npmjs** name:
2851

2952
```bash
3053
npx -y @rethunk/mcp-multi-root-git
3154
bunx @rethunk/mcp-multi-root-git
3255
npm install -g @rethunk/mcp-multi-root-git && mcp-multi-root-git
3356
```
3457

35-
Published entrypoint: **`dist/server.js`** (see npm `bin` / `exports`). Clients typically invoke **`npx`** or **`bunx`** so a global install is optional.
58+
**GitHub Packages** name (after configuring **`.npmrc`** as in [GitHub Packages](#github-packages)):
59+
60+
```bash
61+
npx -y @rethunk-ai/mcp-multi-root-git
62+
bunx @rethunk-ai/mcp-multi-root-git
63+
```
64+
65+
Published entrypoint: **`dist/server.js`** (see `bin` / `exports`). Clients typically invoke **`npx`** or **`bunx`** so a global install is optional.
3666

3767
## Configuration shape (stdio)
3868

0 commit comments

Comments
 (0)