-
Notifications
You must be signed in to change notification settings - Fork 3k
118 lines (101 loc) · 3.96 KB
/
Copy pathrelease.yml
File metadata and controls
118 lines (101 loc) · 3.96 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Release
on:
push:
branches:
- master
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Configure npm authentication
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm build
- name: Create Release PR or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
commit: "chore(release): version packages"
title: "chore(release): version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-mcpb:
name: Upload mcpb Bundle to GitHub Release
needs: release
if: needs.release.outputs.published == 'true' && contains(needs.release.outputs.publishedPackages, '"@upstash/context7-mcp"')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repo
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build mcpb bundle
working-directory: packages/mcp
run: |
VERSION=$(node -p "require('./package.json').version")
jq --arg v "$VERSION" '.version = $v' mcpb/manifest.json > manifest.tmp && mv manifest.tmp mcpb/manifest.json
npm install -g @anthropic-ai/mcpb
pnpm run pack-mcpb
- name: Smoke-test bundle
working-directory: packages/mcp
run: |
unzip -q mcpb/context7.mcpb -d /tmp/mcpb-smoke
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"1"}}}' \
| node /tmp/mcpb-smoke/server/dist/index.mjs | grep -q '"serverInfo"'
- name: Upload to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
# Dedicated slash-free tag: the MCP Registry rejects mcpb URLs whose
# release tag contains '/', which changesets tags (@scope/pkg@x.y.z) do.
run: |
VERSION=$(node -p "require('./packages/mcp/package.json').version")
TAG="mcpb-v$VERSION"
gh release view "$TAG" -R ${{ github.repository }} >/dev/null 2>&1 || \
gh release create "$TAG" --latest=false \
--title "context7.mcpb $VERSION" \
--notes "MCP Bundle for [@upstash/context7-mcp@$VERSION](https://github.com/${{ github.repository }}/releases/tag/%40upstash%2Fcontext7-mcp%40$VERSION)" \
-R ${{ github.repository }}
gh release upload "$TAG" packages/mcp/mcpb/context7.mcpb --clobber -R ${{ github.repository }}
publish-mcp-registry:
name: Publish to MCP Registry
needs: [release, publish-mcpb]
# changesets pushes tags with GITHUB_TOKEN, which cannot trigger other
# workflows — so the registry publish must chain off this job directly.
if: needs.release.outputs.published == 'true' && contains(needs.release.outputs.publishedPackages, '"@upstash/context7-mcp"')
permissions:
id-token: write
contents: read
uses: ./.github/workflows/mcp-registry.yml