Skip to content

Commit 458cc8f

Browse files
mcp-tool-shopclaude
andcommitted
ci: add release.yml for npm Trusted Publishing (OIDC)
Publishes @mcptoolshop/loadout-os (packages/cli) on a v* tag via OIDC trusted publishing + provenance, and creates the GitHub Release. Adapted from the npm-placeholder template for this npm monorepo: publishes the packages/cli workspace member, tag-vs-version check against packages/cli/package.json, npm ci/build/test at root. NOTE: the CLI depends on the unpublished workspace packages claude-memories + claude-rules — those must be published (multi-repo-publish-sequencing) or bundled before the first real publish. Pairs with the v0.0.0 placeholder reserve + TP config (user-run, needs npm auth/OTP). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6325d1a commit 458cc8f

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
permissions:
8+
contents: write # for GitHub Release creation
9+
id-token: write # for npm provenance via Sigstore OIDC
10+
11+
jobs:
12+
release:
13+
name: Publish to npm + GitHub Release
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node
23+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
24+
with:
25+
node-version: '22'
26+
registry-url: 'https://registry.npmjs.org'
27+
28+
- name: Install npm >=11.5 in sandbox for OIDC trusted-publishing auth
29+
run: |
30+
# Node 22's bundled npm 10.9 races on an in-place 'npm i -g npm@latest'
31+
# (MODULE_NOT_FOUND: promise-retry). Install npm@latest into a sandbox
32+
# dir and shadow the system npm via PATH instead.
33+
SANDBOX="$HOME/.npm-cli-sandbox"
34+
mkdir -p "$SANDBOX"
35+
pushd "$SANDBOX" >/dev/null
36+
echo '{"name":"npm-cli-sandbox","version":"0.0.0","private":true}' > package.json
37+
npm install --no-save --no-audit --no-fund --silent npm@latest
38+
popd >/dev/null
39+
echo "$SANDBOX/node_modules/.bin" >> "$GITHUB_PATH"
40+
"$SANDBOX/node_modules/.bin/npm" --version
41+
42+
- name: Verify tag matches packages/cli/package.json version
43+
run: |
44+
PKG_VERSION=$(node -p "require('./packages/cli/package.json').version")
45+
TAG_VERSION="${GITHUB_REF_NAME#v}"
46+
echo "Tag: ${GITHUB_REF_NAME} -> ${TAG_VERSION}"
47+
echo "Package (packages/cli): ${PKG_VERSION}"
48+
if [ "${PKG_VERSION}" != "${TAG_VERSION}" ]; then
49+
echo "::error::Tag ${TAG_VERSION} does not match packages/cli/package.json version ${PKG_VERSION}"
50+
exit 1
51+
fi
52+
53+
- name: Install dependencies
54+
run: npm ci
55+
56+
- name: Build (kernel -> memories -> rules -> cli)
57+
run: npm run build
58+
59+
- name: Test
60+
run: npm test
61+
62+
- name: npm pack dry-run (verify shape)
63+
run: npm pack --dry-run -w packages/cli
64+
65+
# NOTE (Phase 6): @mcptoolshop/loadout-os depends on the workspace packages
66+
# @mcptoolshop/claude-memories + @mcptoolshop/claude-rules, which are NOT yet
67+
# published. Before the first real publish, either publish those deps (see
68+
# multi-repo-publish-sequencing) or bundle/inline them. Until then this
69+
# publish step would produce an install-broken package.
70+
- name: Publish to npm with provenance (OIDC trusted publisher)
71+
run: npm publish -w packages/cli --provenance --access public
72+
73+
- name: Create GitHub Release
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
run: |
77+
gh release create "${GITHUB_REF_NAME}" \
78+
--title "loadout-os ${GITHUB_REF_NAME}" \
79+
--generate-notes \
80+
--verify-tag

0 commit comments

Comments
 (0)