Skip to content

Commit f607e46

Browse files
chore: add MCP publish workflow for manual dispatch
1 parent a991f2f commit f607e46

File tree

3 files changed

+46
-25
lines changed

3 files changed

+46
-25
lines changed

.github/workflows/docker.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ permissions:
99
jobs:
1010
docker-push:
1111
uses: ./.github/workflows/docker-publish.yml
12+
permissions:
13+
contents: read
1214
secrets:
1315
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
1416
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
1517

1618
handle-failure:
1719
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
issues: write
1823
needs: docker-push
19-
if: ${{ failure() }}
24+
if: ${{ always() && needs.docker-push.result == 'failure' }}
2025
steps:
2126
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
2227
with:

.github/workflows/mcp-publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Publish to MCP Registry
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
mcp-publish:
9+
runs-on: ubuntu-latest
10+
environment: Production
11+
permissions:
12+
id-token: write
13+
contents: read
14+
steps:
15+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
16+
- uses: actions/checkout@v5
17+
with:
18+
persist-credentials: false
19+
20+
- name: Install MCP Publisher
21+
run: |
22+
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
23+
24+
- name: Login to MCP Registry
25+
run: ./mcp-publisher login github-oidc
26+
27+
- name: Publish to MCP Registry
28+
run: ./mcp-publisher publish

.github/workflows/publish.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,50 +105,38 @@ jobs:
105105
run: |
106106
PACKAGE_NAME=$(jq -r '.name' < package.json)
107107
VERSION="${{ needs.check.outputs.VERSION }}"
108+
# Strip the 'v' prefix for npm
109+
NPM_VERSION="${VERSION#v}"
108110
MAX_ATTEMPTS=30
109111
SLEEP_SECONDS=10
110112
111-
echo "Waiting for ${PACKAGE_NAME}@${VERSION} to be available on npm..."
113+
echo "Waiting for ${PACKAGE_NAME}@${NPM_VERSION} to be available on npm..."
112114
113115
for i in $(seq 1 $MAX_ATTEMPTS); do
114-
if npm view "${PACKAGE_NAME}@${VERSION}" version >/dev/null 2>&1; then
115-
echo "✓ Package ${PACKAGE_NAME}@${VERSION} is now available on npm"
116+
if npm view "${PACKAGE_NAME}@${NPM_VERSION}" version >/dev/null 2>&1; then
117+
echo "✓ Package ${PACKAGE_NAME}@${NPM_VERSION} is now available on npm"
116118
exit 0
117119
fi
118120
echo "Attempt $i/$MAX_ATTEMPTS: Package not yet available, waiting ${SLEEP_SECONDS}s..."
119121
sleep $SLEEP_SECONDS
120122
done
121123
122-
echo "::error::Package ${PACKAGE_NAME}@${VERSION} did not become available after $((MAX_ATTEMPTS * SLEEP_SECONDS)) seconds"
124+
echo "::error::Package ${PACKAGE_NAME}@${NPM_VERSION} did not become available after $((MAX_ATTEMPTS * SLEEP_SECONDS)) seconds"
123125
exit 1
124126
125127
docker-push:
126128
needs: [check, publish]
127129
uses: ./.github/workflows/docker-publish.yml
128-
permissions: {}
130+
permissions:
131+
contents: read
129132
secrets:
130133
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
131134
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
132135

133136
mcp-publish:
134-
runs-on: ubuntu-latest
135-
environment: Production
136-
permissions:
137-
id-token: write
138137
needs: [check, docker-push]
139138
if: needs.check.outputs.VERSION_EXISTS == 'false'
140-
steps:
141-
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
142-
- uses: actions/checkout@v5
143-
with:
144-
persist-credentials: false
145-
146-
- name: Install MCP Publisher
147-
run: |
148-
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
149-
150-
- name: Login to MCP Registry
151-
run: ./mcp-publisher login github-oidc
152-
153-
- name: Publish to MCP Registry
154-
run: ./mcp-publisher publish
139+
uses: ./.github/workflows/mcp-publish.yml
140+
permissions:
141+
id-token: write
142+
contents: read

0 commit comments

Comments
 (0)