File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -46,13 +46,17 @@ jobs:
4646 PACKAGE_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
4747 PACKAGE_NAME=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])")
4848
49+ # Use jq to check for the version in the releases object
50+ EXISTING_VERSIONS=$(curl -s "https://test.pypi.org/pypi/$PACKAGE_NAME/json" | jq '.releases | keys[]')
51+
4952 echo "Checking for package: $PACKAGE_NAME==$PACKAGE_VERSION"
50- if curl -sI "https://test.pypi.org/project/$PACKAGE_NAME/$PACKAGE_VERSION/" | head -n 1 | grep "HTTP/1.1 200 OK"; then
53+
54+ if [[ "$EXISTING_VERSIONS" =~ "$PACKAGE_VERSION" ]]; then
5155 echo "Package version already exists. Skipping upload."
52- echo "::set-output name= should_publish:: false"
56+ echo "should_publish= false" >> $GITHUB_OUTPUT
5357 else
5458 echo "Package version does not exist. Proceeding with upload."
55- echo "::set-output name= should_publish:: true"
59+ echo "should_publish= true" >> $GITHUB_OUTPUT
5660 fi
5761 - name : Build
5862 if : steps.check_package.outputs.should_publish == 'true'
You can’t perform that action at this time.
0 commit comments