|
44 | 44 | commitMode: github-api |
45 | 45 | env: |
46 | 46 | GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |
| 47 | + |
| 48 | + # See: https://modelcontextprotocol.io/registry/github-actions |
| 49 | + - name: Install mcp-publisher |
| 50 | + if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp') |
| 51 | + working-directory: packages/addon-mcp |
| 52 | + run: | |
| 53 | + curl -L "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 xz mcp-publisher |
| 54 | +
|
| 55 | + - name: Authenticate to MCP Registry |
| 56 | + if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp') |
| 57 | + working-directory: packages/addon-mcp |
| 58 | + run: ./mcp-publisher login github-oidc |
| 59 | + |
| 60 | + - name: Sync addon MCP registry version with jq |
| 61 | + if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp') |
| 62 | + working-directory: packages/addon-mcp |
| 63 | + run: | |
| 64 | + # Pull the published addon version directly from Changesets output. |
| 65 | + # The output is a JSON array like: |
| 66 | + # [{"name":"@storybook/addon-mcp","version":"0.4.1"}, ...] |
| 67 | + ADDON_MCP_VERSION="$(jq -r '.[] | select(.name == "@storybook/addon-mcp") | .version' <<< '${{ steps.changesets.outputs.publishedPackages }}')" |
| 68 | +
|
| 69 | + # Fail fast if the package was expected to publish but no version was found. |
| 70 | + test -n "$ADDON_MCP_VERSION" |
| 71 | +
|
| 72 | + # Update only the server.json fields that need to match the published package version: |
| 73 | + # 1. the top-level MCP server version |
| 74 | + # 2. the local npm package entry version used for installation metadata |
| 75 | + jq --tab --arg version "$ADDON_MCP_VERSION" ' |
| 76 | + .version = $version | |
| 77 | + .packages[0].version = $version |
| 78 | + ' server.json > server.json.tmp |
| 79 | +
|
| 80 | + # Replace the original file only after jq succeeds, to avoid partial writes. |
| 81 | + mv server.json.tmp server.json |
| 82 | +
|
| 83 | + - name: Publish addon MCP to MCP Registry |
| 84 | + if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp') |
| 85 | + working-directory: packages/addon-mcp |
| 86 | + run: ./mcp-publisher publish |
0 commit comments