File tree Expand file tree Collapse file tree 2 files changed +45
-13
lines changed Expand file tree Collapse file tree 2 files changed +45
-13
lines changed Original file line number Diff line number Diff line change @@ -92,17 +92,17 @@ git tag -a vx.y.z -m "Release vx.y.z"
9292git push origin vx.y.z
9393```
9494
95- ### 6. 创建 GitHub Release
96- - 使用 GitHub API 创建 Release
97- - 标签:` vx.y.z `
98- - 标题:` Release vx.y.z ` 或自定义标题
99- - 内容:第 4 步生成的 Release Notes
100- - 发布后,GitHub Actions 会自动触发 PyPI 发布
101-
102- ### 7. 验证发布
95+ ** 推送标签后会自动触发** :
96+ 1 . 构建 Python 包
97+ 2 . 发布到 PyPI
98+ 3 . 创建 GitHub Release(从 CHANGELOG.md 提取发布说明)
99+ 4 . 上传构建产物(wheel 和 sdist)到 Release
100+
101+ ### 6. 验证发布
103102- 等待 GitHub Actions 完成(检查 workflow 状态)
104- - 提供 PyPI 链接:` https://pypi.org/project/hyperliquid-mcp-python/x.y.z/ `
105- - 提供 GitHub Release 链接
103+ - 验证 PyPI 发布:` https://pypi.org/project/hyperliquid-mcp-python/x.y.z/ `
104+ - 验证 GitHub Release:` https://github.com/talkincode/hyperliquid-mcp-python/releases/tag/vx.y.z `
105+ - 确认 Release 包含构建产物附件
106106
107107## 注意事项
108108
Original file line number Diff line number Diff line change 11name : Publish to PyPI
22
33on :
4- release :
5- types : [published]
4+ push :
5+ tags :
6+ - ' v*.*.*'
67 workflow_dispatch :
78
89jobs :
1112 runs-on : ubuntu-latest
1213 permissions :
1314 id-token : write
14- contents : read
15+ contents : write # 需要写权限来创建 Release
1516
1617 steps :
1718 - uses : actions/checkout@v5
3637 uses : pypa/gh-action-pypi-publish@release/v1
3738 with :
3839 password : ${{ secrets.PYPI_API_TOKEN }}
40+
41+ - name : Extract version from tag
42+ id : get_version
43+ run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
44+
45+ - name : Generate release notes
46+ id : release_notes
47+ run : |
48+ # 读取 CHANGELOG.md 中当前版本的内容
49+ VERSION=${{ steps.get_version.outputs.VERSION }}
50+ if [ -f CHANGELOG.md ]; then
51+ # 提取当前版本的变更日志
52+ awk "/## \[${VERSION}\]/,/## \[/" CHANGELOG.md | sed '$d' > release_notes.md
53+ if [ ! -s release_notes.md ]; then
54+ echo "Release v${VERSION}" > release_notes.md
55+ fi
56+ else
57+ echo "Release v${VERSION}" > release_notes.md
58+ fi
59+
60+ - name : Create GitHub Release
61+ uses : softprops/action-gh-release@v1
62+ with :
63+ name : Release v${{ steps.get_version.outputs.VERSION }}
64+ body_path : release_notes.md
65+ files : |
66+ dist/*
67+ draft : false
68+ prerelease : false
69+ env :
70+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments