File tree Expand file tree Collapse file tree 3 files changed +26
-8
lines changed
Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -26,20 +26,38 @@ jobs:
2626 steps :
2727 - name : Check out committed code
2828 uses : actions/checkout@v4
29- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
30- id : python
31- uses : actions/setup-python@v5
32- with :
33- python-version : ${{ env.DEFAULT_PYTHON }}
3429 - name : Prepare uv
3530 run : |
3631 pip install uv
3732 uv venv --seed venv
33+ . venv/bin/activate
34+ uv pip install toml
35+ - name : Check for existing package on PyPI
36+ id : check_package
37+ run : |
38+ . venv/bin/activate
39+ PACKAGE_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
40+ PACKAGE_NAME=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])")
41+
42+ # Use jq to check for the version in the releases object
43+ EXISTING_VERSIONS=$(curl -s "https://pypi.org/pypi/$PACKAGE_NAME/json" | jq '.releases | keys[]')
44+
45+ echo "Checking for package: $PACKAGE_NAME==$PACKAGE_VERSION"
46+
47+ if [[ "$EXISTING_VERSIONS" =~ "$PACKAGE_VERSION" ]]; then
48+ echo "Package version already exists. Skipping upload."
49+ echo "should_publish=false" >> $GITHUB_OUTPUT
50+ else
51+ echo "Package version does not exist. Proceeding with upload."
52+ echo "should_publish=true" >> $GITHUB_OUTPUT
53+ fi
3854 - name : Build
55+ if : steps.check_package.outputs.should_publish == 'true'
3956 run : |
4057 . venv/bin/activate
4158 uv build
4259 - name : Publish distribution 📦 to PyPI
60+ if : steps.check_package.outputs.should_publish == 'true'
4361 run : |
4462 . venv/bin/activate
4563 uv publish
Original file line number Diff line number Diff line change 11# Changelog
22
3- ## Ongoing / 1.7.8a0
3+ ## Ongoing / 1.7.8a0+1
44
5- - Chores move module publishing on (test)pypi to Trusted Publishing (and using uv) - released as alpha 1.7.8a0 to demonstrate functionality
5+ - Chores move module publishing on (test)pypi to Trusted Publishing (and using uv) - released as alpha 1.7.8a0+1 to demonstrate functionality
66
77## v1.7.7
88
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " plugwise"
7- version = " 1.7.8a0 "
7+ version = " 1.7.8a1 "
88license = " MIT"
99description = " Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
1010readme = " README.md"
You can’t perform that action at this time.
0 commit comments