Skip to content

Commit 1aa9665

Browse files
committed
Refactor GitHub Actions workflows: separate MCP publishing into manual and automated processes, enhance testing and building steps for PyPI, and improve schema validation for server.json.
1 parent ef142cf commit 1aa9665

2 files changed

Lines changed: 85 additions & 48 deletions

File tree

‎.github/workflows/publish-mcp.yml‎

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Publish to MCP Registry
1+
name: Publish to MCP Registry (manual)
22

33
on:
4-
release:
5-
types: [published]
4+
# This workflow is kept for manual runs only. The normal release flow
5+
# is handled by the consolidated release workflow.
6+
workflow_dispatch:
67

78
jobs:
89
publish:
@@ -13,53 +14,14 @@ jobs:
1314

1415
steps:
1516
- name: Checkout code
16-
uses: actions/checkout@v5
17-
18-
- name: Set up Python
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: "3.12"
22-
23-
- name: Install uv
24-
uses: astral-sh/setup-uv@v5
25-
26-
- name: Install dependencies
27-
run: |
28-
uv sync --all-extras --dev
29-
30-
- name: Run tests
31-
run: |
32-
uv run pytest -q
33-
34-
- name: Build wheel
35-
run: |
36-
uv build
37-
38-
- name: Validate server.json against schema
39-
run: |
40-
uv run python - <<'PY'
41-
import json, sys, urllib.request
42-
from jsonschema import validate
43-
from jsonschema.exceptions import ValidationError
44-
server = json.load(open('server.json'))
45-
schema_url = server.get('$schema')
46-
with urllib.request.urlopen(schema_url) as r:
47-
schema = json.load(r)
48-
try:
49-
validate(instance=server, schema=schema)
50-
except ValidationError as e:
51-
print('Schema validation failed:', e, file=sys.stderr)
52-
sys.exit(1)
53-
print('server.json is valid')
54-
PY
17+
uses: actions/checkout@v4
5518

5619
- name: Install MCP Publisher
5720
run: |
5821
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.1.0/mcp-publisher_1.1.0_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
5922
6023
- name: Login to MCP Registry (DNS auth)
6124
run: |
62-
# Extract private key using official MCP publisher method
6325
echo "${{ secrets.MCP_PRIVATE_KEY }}" > temp_key.pem
6426
PRIVATE_KEY_HEX=$(openssl pkey -in temp_key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')
6527
./mcp-publisher login dns --domain pipeboard.co --private-key "$PRIVATE_KEY_HEX"

‎.github/workflows/publish.yml‎

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish to PyPI
1+
name: "Release: Test, PyPI, MCP"
22

33
on:
44
release:
@@ -7,7 +7,57 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
publish:
10+
test_and_build:
11+
name: Test and Build (pre-release gate)
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v5
27+
28+
- name: Install dependencies
29+
run: |
30+
uv sync --all-extras --dev
31+
32+
- name: Run tests
33+
run: |
34+
uv run pytest -q
35+
36+
- name: Build wheel and sdist
37+
run: |
38+
uv build
39+
40+
- name: Validate server.json against schema
41+
run: |
42+
uv run python - <<'PY'
43+
import json, sys, urllib.request
44+
from jsonschema import validate
45+
from jsonschema.exceptions import ValidationError
46+
server = json.load(open('server.json'))
47+
schema_url = server.get('$schema')
48+
with urllib.request.urlopen(schema_url) as r:
49+
schema = json.load(r)
50+
try:
51+
validate(instance=server, schema=schema)
52+
except ValidationError as e:
53+
print('Schema validation failed:', e, file=sys.stderr)
54+
sys.exit(1)
55+
print('server.json is valid')
56+
PY
57+
58+
publish_pypi:
59+
name: Publish to PyPI
60+
needs: test_and_build
1161
runs-on: ubuntu-latest
1262
environment: release
1363
permissions:
@@ -34,6 +84,31 @@ jobs:
3484
- name: Publish to PyPI
3585
uses: pypa/gh-action-pypi-publish@release/v1
3686
with:
37-
# Using trusted publishing (no API token needed)
38-
# Make sure to configure trusted publishing in PyPI project settings
39-
verbose: true
87+
verbose: true
88+
89+
publish_mcp:
90+
name: Publish to MCP Registry
91+
needs: publish_pypi
92+
runs-on: ubuntu-latest
93+
permissions:
94+
id-token: write
95+
contents: read
96+
97+
steps:
98+
- name: Check out code
99+
uses: actions/checkout@v4
100+
101+
- name: Install MCP Publisher
102+
run: |
103+
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.1.0/mcp-publisher_1.1.0_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
104+
105+
- name: Login to MCP Registry (DNS auth)
106+
run: |
107+
# Extract private key using official MCP publisher method
108+
echo "${{ secrets.MCP_PRIVATE_KEY }}" > temp_key.pem
109+
PRIVATE_KEY_HEX=$(openssl pkey -in temp_key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')
110+
./mcp-publisher login dns --domain pipeboard.co --private-key "$PRIVATE_KEY_HEX"
111+
rm -f temp_key.pem
112+
113+
- name: Publish to MCP Registry
114+
run: ./mcp-publisher publish

0 commit comments

Comments
 (0)