-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (75 loc) · 2.47 KB
/
release.yml
File metadata and controls
89 lines (75 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Release
on:
push:
tags:
- "v*.*.*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "24"
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.11
- name: Assert Node.js version
run: node -e "const v=+process.version.slice(1).split('.')[0]; if(v<22)process.exit(1)"
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Lint and format check
run: bun run check
- name: Unit tests
run: bun run test
- name: Verify git tag matches package.json version
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/v}"
PKG=$(node -p "require('./package.json').version")
if [ "$TAG" != "$PKG" ]; then
echo "::error::Git tag v$TAG must match package.json version $PKG (publish aborted)."
exit 1
fi
- name: Create tarball for GitHub Release
id: pack
run: |
set -euo pipefail
npm pack
echo "tarball=$(ls -t rethunk-mcp-multi-root-git-*.tgz | head -1)" >> "$GITHUB_OUTPUT"
- name: Publish to GitHub Packages (npm registry)
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
node <<'NODE'
const fs = require("node:fs");
const p = JSON.parse(fs.readFileSync("package.json", "utf8"));
p.name = "@rethunk-ai/mcp-multi-root-git";
p.publishConfig = {
registry: "https://npm.pkg.github.com",
access: "public",
};
fs.writeFileSync("package.json", JSON.stringify(p, null, 2) + "\n");
NODE
{
echo "@rethunk-ai:registry=https://npm.pkg.github.com"
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}"
} > .npmrc
npm publish --access public
- name: Create GitHub Release (official gh CLI, no third-party action)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh release create "${GITHUB_REF_NAME}" "${{ steps.pack.outputs.tarball }}" \
--verify-tag \
--generate-notes