File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868
6969 - name : Check if version is on PyPI
7070 id : pypi_check
71+ env :
72+ VERSION : ${{ steps.version.outputs.version }}
7173 run : |
72- if pip index versions pycyphal2 2>/dev/null | grep -qF "${{ steps.version.outputs.version }}"; then
74+ if python - <<'PY'
75+ from __future__ import annotations
76+
77+ import json
78+ import os
79+ import urllib.error
80+ import urllib.request
81+
82+ version = os.environ["VERSION"]
83+ try:
84+ with urllib.request.urlopen("https://pypi.org/pypi/pycyphal2/json", timeout=20) as response:
85+ data = json.load(response)
86+ except urllib.error.HTTPError as ex:
87+ if ex.code == 404:
88+ raise SystemExit(1)
89+ raise
90+
91+ raise SystemExit(0 if version in data.get("releases", {}) else 1)
92+ PY
93+ then
7394 echo "exists=true" >> "$GITHUB_OUTPUT"
7495 else
7596 echo "exists=false" >> "$GITHUB_OUTPUT"
You can’t perform that action at this time.
0 commit comments