Skip to content

Commit af23ff0

Browse files
authored
Merge pull request #86 from redis/ci/add-mcp-registry-publish
Ci/add mcp registry publish
2 parents e6b17ce + 27ad778 commit af23ff0

File tree

2 files changed

+92
-15
lines changed

2 files changed

+92
-15
lines changed

.github/workflows/release.yml

Lines changed: 90 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,89 @@
242242
name: dist-${{ needs.validate-release.outputs.version }}
243243
path: dist/
244244
retention-days: 90
245-
246-
notify-success:
245+
246+
publish-mcp-registry:
247247
runs-on: ubuntu-latest
248248
needs: [validate-release, build-and-publish]
249-
if: success()
249+
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run) }}
250+
permissions:
251+
id-token: write # Required for GitHub OIDC authentication
252+
contents: read
253+
254+
steps:
255+
- name: ⚙️ Harden Runner
256+
uses: step-security/harden-runner@v2
257+
with:
258+
egress-policy: audit
259+
260+
- name: ⚙️ Checkout the project
261+
uses: actions/checkout@v5
262+
263+
- name: ⚙️ Update server.json version
264+
run: |
265+
# Determine the target version
266+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
267+
TARGET_VERSION="${{ github.event.inputs.version }}"
268+
echo "Using version from manual trigger: $TARGET_VERSION"
269+
elif [[ "${{ github.event_name }}" == "release" ]]; then
270+
RELEASE_TAG="${{ github.event.release.tag_name }}"
271+
TARGET_VERSION=$(echo "$RELEASE_TAG" | sed 's/^v//')
272+
echo "Using version from release tag: $TARGET_VERSION (tag: $RELEASE_TAG)"
273+
else
274+
echo "Error: Unexpected event type: ${{ github.event_name }}"
275+
exit 1
276+
fi
277+
278+
# Update version in server.json (with validation)
279+
if ! jq --arg v "$TARGET_VERSION" '.version = $v | .packages[0].version = $v' server.json > tmp; then
280+
echo "Error: jq failed to update server.json"
281+
rm -f tmp
282+
exit 1
283+
fi
284+
285+
# Verify the updated content is valid JSON before replacing
286+
if ! jq empty tmp 2>/dev/null; then
287+
echo "Error: Updated server.json is not valid JSON"
288+
cat tmp
289+
rm -f tmp
290+
exit 1
291+
fi
292+
293+
# Replace original with validated update
294+
mv tmp server.json
295+
296+
echo "Updated server.json:"
297+
cat server.json
298+
299+
- name: ⚙️ Install MCP Publisher
300+
run: |
301+
curl -fL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xzf - mcp-publisher
302+
chmod +x mcp-publisher
303+
304+
- name: ⚙️ Login to MCP Registry
305+
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run) }}
306+
run: ./mcp-publisher login github-oidc
307+
308+
- name: ⚙️ Publish to MCP Registry
309+
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run) }}
310+
run: ./mcp-publisher publish
311+
312+
- name: ⚙️ Dry run notification
313+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run == true }}
314+
run: |
315+
VERSION=$(jq -r '.version' server.json)
316+
echo "🔍 DRY RUN MODE - MCP Registry preparation successful!"
317+
echo ""
318+
echo "server.json is valid JSON and ready to publish"
319+
echo "Server: io.github.redis/mcp-redis"
320+
echo "Version: $VERSION"
321+
echo ""
322+
echo "To actually publish to MCP Registry, run this workflow again without dry_run enabled"
323+
324+
notify-success:
325+
runs-on: ubuntu-latest
326+
needs: [validate-release, build-and-publish, publish-mcp-registry]
327+
if: ${{ always() && !cancelled() && needs.build-and-publish.result == 'success' }}
250328
steps:
251329
- name: ⚙️ Success notification
252330
run: |
@@ -255,12 +333,18 @@
255333
echo "📦 Package built successfully but not published"
256334
echo "🎯 Target environment: ${{ github.event.inputs.environment || 'pypi' }}"
257335
else
258-
echo "🎉 Successfully released Redis MCP Server v${{ github.event.inputs.version || needs.validate-release.outputs.version }} to ${{ github.event.inputs.environment || 'PyPI' }}!"
336+
echo "🎉 Successfully released Redis MCP Server v${{ github.event.inputs.version || needs.validate-release.outputs.version }}!"
337+
echo ""
338+
echo "📦 PyPI Package:"
259339
if [[ "${{ github.event.inputs.environment }}" == "testpypi" ]]; then
260-
echo "📦 Package: https://test.pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
340+
echo " https://test.pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
261341
else
262-
echo "📦 Package: https://pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
342+
echo " https://pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
263343
fi
344+
echo ""
345+
echo "🔌 MCP Registry:"
346+
echo " https://registry.modelcontextprotocol.io/v0/servers?search=redis"
347+
echo ""
264348
if [[ "${{ github.event_name }}" == "release" ]]; then
265349
echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
266350
else

server.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@
33
"name": "io.github.redis/mcp-redis",
44
"title": "Redis MCP Server",
55
"description": "Natural language interface designed for agentic applications to manage and search data in Redis.",
6-
"version": "0.3.6",
6+
"version": "$VERSION",
77
"packages": [
88
{
99
"registryType": "pypi",
1010
"identifier": "redis-mcp-server",
11-
"version": "0.3.6",
12-
"transport": {
13-
"type": "stdio"
14-
}
15-
},
16-
{
17-
"registryType": "oci",
18-
"identifier": "docker.io/mcp/redis:latest",
11+
"version": "$VERSION",
1912
"transport": {
2013
"type": "stdio"
2114
}

0 commit comments

Comments
 (0)