Skip to content

Commit 204bfad

Browse files
authored
Merge pull request #13 from Serverless-Devs/fix-add-include-usage
fix: 更新获取最新版本的逻辑,从 PyPI 获取版本信息并优化处理流程
2 parents 15e5ac7 + 520d95c commit 204bfad

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/release-test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ jobs:
3030
with:
3131
python-version: '3.10'
3232

33-
- name: Get latest test version and calculate next version
33+
- name: Get latest version from PyPI and calculate next version
3434
id: version
3535
run: |
36-
# 获取所有 agentrun-inner-test-v* 的 tags,找到最新版本
37-
LATEST_TAG=$(git tag -l "agentrun-inner-test-v*" | sort -V | tail -n 1)
36+
# 从 PyPI 获取 agentrun-inner-test 的最新版本
37+
PYPI_RESPONSE=$(curl -s https://pypi.org/pypi/agentrun-inner-test/json 2>/dev/null || echo "")
3838
39-
if [ -z "$LATEST_TAG" ]; then
40-
# 如果没有找到任何 tag,从 0.0.0 开始
39+
if [ -z "$PYPI_RESPONSE" ] || echo "$PYPI_RESPONSE" | grep -q "Not Found"; then
40+
# 如果包不存在,从 0.0.0 开始
4141
CURRENT_VERSION="0.0.0"
42-
echo "No existing test tags found, starting from 0.0.0"
42+
echo "Package not found on PyPI, starting from 0.0.0"
4343
else
44-
# 从 tag 中提取版本号
45-
CURRENT_VERSION="${LATEST_TAG#agentrun-inner-test-v}"
46-
echo "Latest test tag: $LATEST_TAG (version: $CURRENT_VERSION)"
44+
# 从 PyPI 响应中提取最新版本
45+
CURRENT_VERSION=$(echo "$PYPI_RESPONSE" | python3 -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
46+
echo "Latest version on PyPI: $CURRENT_VERSION"
4747
fi
4848
4949
# 解析版本号

0 commit comments

Comments
 (0)