diff options
| author | 2025-12-31 18:05:19 +0800 | |
|---|---|---|
| committer | 2025-12-31 18:05:19 +0800 | |
| commit | 5b4c1572055c01c239b6bb648c70273167d6bffe (patch) | |
| tree | d59124aaba630b98dca5d2db4c2e02be64539320 /.github | |
| parent | 8469222a80f204d9d0f6b5ba4dbdab4a0ff37649 (diff) | |
| download | base-model-5b4c1572055c01c239b6bb648c70273167d6bffe.tar.gz base-model-5b4c1572055c01c239b6bb648c70273167d6bffe.zip | |
fix: add step to fix package metadata before publishing to TestPyPI
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/publish.yml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a2e47d4..1c7d33a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -120,11 +120,40 @@ jobs: done ls -la + # 检查并修复 PKG-INFO 中的包名 + - name: Fix package metadata + run: | + COMMIT_HASH="${{ steps.commit.outputs.hash }}" + cd dist + # 修改 .tar.gz 中的 METADATA 或 PKG-INFO + for file in *.tar.gz; do + tar -xzf "$file" + dir=$(tar -tzf "$file" | head -1 | cut -f1 -d"/") + cd "$dir" + # 修改 PKG-INFO 中的 Name 字段 + sed -i "s/^Name: base-model-trpgner/Name: ${COMMIT_HASH}/" PKG-INFO + cd .. + tar -czf "$file" "${dir}/" + rm -rf "$dir" + done + # 修改 .whl 中的 METADATA + for file in *.whl; do + unzip -q "$file" + dir=$(unzip -Z1 "$file" | head -1) + cd "$dir" + sed -i "s/^Name: base-model-trpgner/Name: ${COMMIT_HASH}/" *.dist-info/METADATA + cd .. + zip -qr "$file" "${dir}/" + rm -rf "$dir" + done + ls -la + - name: Publish to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy password: ${{ secrets.TEST_PYPI_TOKEN }} + verbose: true publish-pypi: name: Publish to PyPI |
