@@ -240,23 +240,23 @@ jobs:
240
240
# This is the root file representing the package for all the sub-packages.
241
241
- name : Bump version - packaging__.py
242
242
run : |
243
+ # Install required packages
244
+ pip install semver
245
+
246
+ # Get version tag and remove 'v' prefix
243
247
version_tag=${{ github.event.release.tag_name }}
244
- version_tag=${version_tag#v} # Remove the leading 'v'
245
-
246
- # Handle RC versions
247
- if [[ $version_tag =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)[-.]?rc([0-9]+)$ ]]; then
248
- # For RC versions (PEP 440 format)
249
- major="${BASH_REMATCH[1]}"
250
- minor="${BASH_REMATCH[2]}"
251
- patch="${BASH_REMATCH[3]}"
252
- rc_num="${BASH_REMATCH[4]}"
253
- version_tuple="$major, $minor, $patch, 'rc', $rc_num" # Will become "1.2.3rc1"
254
- else
255
- # Regular versions
256
- version_tuple=$(echo $version_tag | sed 's/\./, /g')
257
- fi
258
-
259
- sed -i "s/VERSION = (.*/VERSION = (${version_tuple})/" packages/__packaging__.py
248
+ version_tag=${version_tag#v}
249
+
250
+ # Convert semver to PyPI version using the script
251
+ pypi_version=$(python smver2pypi.py $version_tag)
252
+
253
+ # Update only the __version__ in __packaging__.py
254
+ sed -i "s/__version__ = VERSION_STRING/__version__ = \"$pypi_version\"/" packages/__packaging__.py
255
+
256
+ # Print the result for verification
257
+ echo "Original version tag: $version_tag"
258
+ echo "PyPI version: $pypi_version"
259
+ cat packages/__packaging__.py
260
260
261
261
- name : Cleanup setup.py and Build every sub-packages
262
262
run : |
0 commit comments