Skip to content

Commit d0d0f3b

Browse files
authored
try to fix checking package version workflow
1 parent bdc275b commit d0d0f3b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Set up Python
6262
uses: actions/setup-python@v5
6363
with:
64-
python-version: '3.11'
64+
python-version: '3.10'
6565

6666
- name: Install tools
6767
run: |
@@ -79,9 +79,14 @@ jobs:
7979
run: |
8080
VERSION="${{ steps.get_version.outputs.version }}"
8181
PACKAGE="asrpy"
82-
EXISTS=$(python -c "import json, urllib.request; versions = json.load(urllib.request.urlopen(f'https://pypi.org/pypi/{PACKAGE}/json'))['releases']; print('true' if '$VERSION' in versions else 'false')")
82+
EXISTS=$(python -c "import json, sys, urllib.request;
83+
package = sys.argv[1]
84+
version = sys.argv[2]
85+
versions = json.load(urllib.request.urlopen(f'https://pypi.org/pypi/{package}/json'))['releases']
86+
print('true' if version in versions else 'false')" "$PACKAGE" "$VERSION")
8387
echo "exists=$EXISTS" >> $GITHUB_OUTPUT
8488
89+
8590
- name: Stop if version already exists
8691
if: steps.check_version.outputs.exists == 'true'
8792
run: echo "Version already exists on PyPI — skipping publish."

0 commit comments

Comments
 (0)