Skip to content

Commit 1856396

Browse files
committed
[main]: version issue workflow fix
1 parent 239512a commit 1856396

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: CI & Publish to TestPyPI
2+
run-name: Publish Package to TestPyPI
23

34
on:
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

0 commit comments

Comments
 (0)