-
Notifications
You must be signed in to change notification settings - Fork 172
chore: fix publish workflow for MCP registry #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9d5b4dd
6a9157d
9326014
a991f2f
f607e46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| name: Build and Push Docker Image | ||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| DOCKERHUB_USERNAME: | ||
| required: true | ||
| DOCKERHUB_PASSWORD: | ||
| required: true | ||
|
|
||
| jobs: | ||
| build-push: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Get version and date | ||
| id: release-meta | ||
| run: | | ||
| VERSION=$(npm pkg get version | tr -d '"') | ||
| DATE=$(date +'%Y-%m-%d') | ||
| echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT" | ||
| echo "DATE=${DATE}" >> "$GITHUB_OUTPUT" | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef | ||
| with: | ||
| username: "${{ secrets.DOCKERHUB_USERNAME }}" | ||
| password: "${{ secrets.DOCKERHUB_PASSWORD }}" | ||
|
|
||
| - name: Build and push image to dockerhub registry | ||
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| tags: ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:latest, ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:${{ steps.release-meta.outputs.VERSION }}, ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:${{ steps.release-meta.outputs.VERSION }}-${{ steps.release-meta.outputs.DATE }} | ||
| file: Dockerfile | ||
| push: true | ||
| provenance: mode=max | ||
| sbom: true | ||
| build-args: | | ||
| VERSION=${{ steps.release-meta.outputs.VERSION }} | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||
| --- | ||||
| name: Publish to MCP Registry | ||||
| on: | ||||
| workflow_call: | ||||
| workflow_dispatch: | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think you only need this on the other one
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This in intentional because we still want to be able to publish to MCP registry manually in case the relevant parts in publish job fails. Also relevant for the current v1.3.0 release which was never published in MCP registry so this is expected to help with that as well. |
||||
|
|
||||
| jobs: | ||||
| mcp-publish: | ||||
| runs-on: ubuntu-latest | ||||
| environment: Production | ||||
| permissions: | ||||
| id-token: write | ||||
| contents: read | ||||
| steps: | ||||
| - uses: GitHubSecurityLab/actions-permissions/monitor@v1 | ||||
| - uses: actions/checkout@v5 | ||||
| with: | ||||
| persist-credentials: false | ||||
|
|
||||
| - name: Install MCP Publisher | ||||
| run: | | ||||
| 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 | ||||
| - name: Login to MCP Registry | ||||
| run: ./mcp-publisher login github-oidc | ||||
|
|
||||
| - name: Publish to MCP Registry | ||||
| run: ./mcp-publisher publish | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: should this be a workflow or an action? tbh not sure what pros and cons of each are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They both could be used for reusability. I used the workflow here only because they have better support for credentials masking. I don't have a strong feeling about it though as I only recently found about this and was curious to see this in action.