Skip to content

Commit 0eadb5e

Browse files
committed
feat: 添加手动触发 workflow 支持,可跳过 PyPI 发布
- 添加 workflow_dispatch 触发器 - 添加 skip_pypi 输入参数,可跳过 PyPI 发布 - 添加 version 输入参数,手动指定版本号 - 修改 pypi-publish job 条件判断 - 修改 mcp-registry-publish job 支持独立运行 使用方法: 1. 在 GitHub Actions 页面手动触发 2. 设置 skip_pypi: true 3. 输入版本号(如 1.1.0) 4. 只发布到 MCP Registry
1 parent 24d2199 commit 0eadb5e

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ name: Release
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
skip_pypi:
9+
description: 'Skip PyPI publish (only publish to MCP Registry)'
10+
required: false
11+
default: 'false'
12+
type: boolean
13+
version:
14+
description: 'Version to publish (e.g., 1.1.0, required when skip_pypi is true)'
15+
required: false
16+
type: string
617

718
jobs:
819
test:
@@ -88,6 +99,7 @@ jobs:
8899
pypi-publish:
89100
name: Upload release to PyPI
90101
needs: build
102+
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.skip_pypi != 'true') }}
91103
runs-on: ubuntu-latest
92104
environment:
93105
name: pypi
@@ -104,17 +116,23 @@ jobs:
104116

105117
mcp-registry-publish:
106118
name: Publish to MCP Registry
107-
needs: pypi-publish
119+
needs: [build, pypi-publish]
120+
if: always() && needs.build.result == 'success' && (needs.pypi-publish.result == 'success' || needs.pypi-publish.result == 'skipped')
108121
runs-on: ubuntu-latest
109122
permissions:
110123
id-token: write
111124
contents: read
112125
steps:
113126
- uses: actions/checkout@v4
114127

115-
- name: Get version from tag
128+
- name: Get version from tag or input
116129
id: get_version
117-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
130+
run: |
131+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
132+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
133+
else
134+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
135+
fi
118136
119137
- name: Update server.json version
120138
run: |

0 commit comments

Comments
 (0)