|
242 | 242 | name: dist-${{ needs.validate-release.outputs.version }} |
243 | 243 | path: dist/ |
244 | 244 | retention-days: 90 |
245 | | - |
246 | | - notify-success: |
| 245 | + |
| 246 | + publish-mcp-registry: |
247 | 247 | runs-on: ubuntu-latest |
248 | 248 | 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' }} |
250 | 328 | steps: |
251 | 329 | - name: ⚙️ Success notification |
252 | 330 | run: | |
|
255 | 333 | echo "📦 Package built successfully but not published" |
256 | 334 | echo "🎯 Target environment: ${{ github.event.inputs.environment || 'pypi' }}" |
257 | 335 | 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:" |
259 | 339 | 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 }}/" |
261 | 341 | 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 }}/" |
263 | 343 | fi |
| 344 | + echo "" |
| 345 | + echo "🔌 MCP Registry:" |
| 346 | + echo " https://registry.modelcontextprotocol.io/v0/servers?search=redis" |
| 347 | + echo "" |
264 | 348 | if [[ "${{ github.event_name }}" == "release" ]]; then |
265 | 349 | echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" |
266 | 350 | else |
|
0 commit comments