File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,34 @@ jobs:
3737 run : |
3838 pip install uv
3939 uv venv --seed venv
40+ . venv/bin/activate
41+ uv pip install toml
42+ - name : Check for existing package on TestPyPI
43+ id : check_package
44+ run : |
45+ . venv/bin/activate
46+ PACKAGE_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
47+ PACKAGE_NAME=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])")
48+
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+
52+ echo "Checking for package: $PACKAGE_NAME==$PACKAGE_VERSION"
53+
54+ if [[ "$EXISTING_VERSIONS" =~ "$PACKAGE_VERSION" ]]; then
55+ echo "Package version already exists. Skipping upload."
56+ echo "should_publish=false" >> $GITHUB_OUTPUT
57+ else
58+ echo "Package version does not exist. Proceeding with upload."
59+ echo "should_publish=true" >> $GITHUB_OUTPUT
60+ fi
4061 - name : Build
62+ if : steps.check_package.outputs.should_publish == 'true'
4163 run : |
4264 . venv/bin/activate
4365 uv build
4466 - name : Publish distribution 📦 to TestPyPI
67+ if : steps.check_package.outputs.should_publish == 'true'
4568 run : |
4669 . venv/bin/activate
4770 uv publish --publish-url https://test.pypi.org/legacy/
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " airos"
7- version = " 0.0.3a1 "
7+ version = " 0.0.3a2 "
88license = " MIT"
99description = " Ubiquity airOS module(s) for Python 3."
1010readme = " README.md"
You can’t perform that action at this time.
0 commit comments