File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : CI & Publish to TestPyPI
2+ run-name : Publish Package to TestPyPI
23
34on :
45 push :
@@ -43,19 +44,24 @@ jobs:
4344 - name : Check if version exists
4445 id : check_version
4546 run : |
47+ # 1. Get metadata from pyproject.toml
4648 PACKAGE_NAME=$(poetry version | awk '{print $1}')
4749 PACKAGE_VERSION=$(poetry version --short)
48- STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://test.pypi.org)
4950
5051 echo "pkg_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
5152 echo "pkg_ver=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
5253
54+ # 2. Check the SPECIFIC version JSON endpoint
55+ # We use the JSON API because it's reliable for bots
56+ URL="https://test.pypi.org/pypi/$PACKAGE_NAME/$PACKAGE_VERSION/json"
57+ STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
58+
5359 if [ "$STATUS" == "200" ]; then
5460 echo "should_publish=false" >> $GITHUB_OUTPUT
5561 echo "### ⏭️ Skip: Version $PACKAGE_VERSION already exists" >> $GITHUB_STEP_SUMMARY
56- echo "No new version detected in pyproject.toml. Check it here: [TestPyPI](https://test.pypi.org)" >> $GITHUB_STEP_SUMMARY
5762 else
5863 echo "should_publish=true" >> $GITHUB_OUTPUT
64+ echo "### 🚀 New version $PACKAGE_VERSION detected" >> $GITHUB_STEP_SUMMARY
5965 fi
6066
6167 - name : Configure and Publish
You can’t perform that action at this time.
0 commit comments