Repository navigation
135 lines (121 loc) · 5.27 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (121 loc) · 5.27 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Prebuilt binaries, so installing mobium does not need Go.
#
# A tag `v<version>` builds every platform with `make dist`, checks the
# archives against SHA256SUMS and runs the Linux binary to see it reports
# the tag's version, then attaches them to a GitHub Release of that tag.
# A pull request that touches this file or the Makefile does everything but
# the release, so the build is proven before a tag ever needs it.
#
# Nothing here signs or notarizes the macOS binaries: that needs an Apple
# Developer Program membership. docs/SETUP.md says what that means for
# someone who downloads one.
name: Release
on:
push:
tags: ['v*']
pull_request:
paths:
- Makefile
- .github/workflows/release.yml
- packaging/mcp/**
permissions:
contents: read
jobs:
build:
name: Build and verify the release archives
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
clients/go/go.sum
# The tag names the version, without its leading v; a pull request
# gets one that cannot be mistaken for a release.
- name: Version
run: |
if [ "${GITHUB_REF_TYPE}" = tag ]; then v="${GITHUB_REF_NAME#v}"; else v="0.0.0-pr${{ github.event.number }}"; fi
echo "VERSION=$v" >> "$GITHUB_ENV"
- name: Test what is being released
run: make test
- name: make dist
run: make dist VERSION="$VERSION"
# The MCP bundle and the MCP Registry entry, from the archives above.
- name: make mcpb
run: make mcpb VERSION="$VERSION"
# Read back, not assumed: every archive against its checksum, and the
# binary asked what version it is.
- name: Verify
run: |
cd dist
shasum -a 256 -c SHA256SUMS
tar -xzf "mobium_${VERSION}_linux_amd64.tar.gz"
got=$("./mobium_${VERSION}_linux_amd64/mobium" --version)
echo "$got"
[ "$got" = "mobium version $VERSION" ] || { echo "the binary says '$got', not $VERSION"; exit 1; }
rm -rf "mobium_${VERSION}_linux_amd64"
ls -l
# The bundle checked by the tools that will read it: its manifest by
# the MCPB CLI, the registry entry by mcp-publisher against the live
# registry, both pinned, mcp-publisher checked against its checksums —
# and the bundle run, through its launcher, as an MCP server.
- name: Verify the MCP bundle and registry entry
env:
DISABLE_TELEMETRY: '1'
run: |
mkdir -p /tmp/mcpb && cd /tmp/mcpb
unzip -q "$GITHUB_WORKSPACE/dist/mobium-${VERSION}.mcpb"
npx -y @anthropic-ai/mcpb@2.1.2 validate manifest.json
python3 - <<'PY'
import json, subprocess
p = subprocess.Popen(["server/mobium", "mcp"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
def req(i, m, params):
p.stdin.write(json.dumps({"jsonrpc": "2.0", "id": i, "method": m, "params": params}) + "\n")
p.stdin.flush()
while True:
r = json.loads(p.stdout.readline())
if r.get("id") == i:
return r["result"]
req(1, "initialize", {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "ci", "version": "1"}})
n = len(req(2, "tools/list", {})["tools"])
p.stdin.close(); p.wait(timeout=30)
assert n > 0, "the bundle's server listed no tools"
print(f"the bundle's server answered, with {n} tools")
PY
b=https://github.com/modelcontextprotocol/registry/releases/download/v1.8.1
curl -fsSLO "$b/mcp-publisher_linux_amd64.tar.gz" && curl -fsSLO "$b/registry_1.8.1_checksums.txt"
grep ' mcp-publisher_linux_amd64.tar.gz$' registry_1.8.1_checksums.txt | sha256sum -c
tar -xzf mcp-publisher_linux_amd64.tar.gz mcp-publisher
cd "$GITHUB_WORKSPACE/dist" && /tmp/mcpb/mcp-publisher validate server.json
shasum -a 256 -c SHA256SUMS
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
if-no-files-found: error
publish:
name: Publish the release
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- name: Create the release
env:
GH_TOKEN: ${{ github.token }}
# A tag with a pre-release part, v0.1.0-rc1, is a prerelease and never
# Latest: a release candidate is for checking the download a user gets,
# not for anyone to take for the release.
run: |
pre=""
case "$GITHUB_REF_NAME" in *-*) pre="--prerelease --latest=false" ;; esac
gh release create "$GITHUB_REF_NAME" dist/* $pre \
--repo "$GITHUB_REPOSITORY" --verify-tag --title "mobium ${GITHUB_REF_NAME}" \
--notes "Prebuilt mobium for macOS, Linux and Windows, amd64 and arm64, and mobium-${GITHUB_REF_NAME#v}.mcpb, the MCP bundle for macOS and Linux. Check a download against SHA256SUMS. The macOS binaries are not notarized; see docs/SETUP.md."