File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 77 required : true
88 following_version :
99 description : The following (dev) version
10- required : true
10+ required : false
1111 version_bump_script :
1212 description : The version bump script
1313 default : hatch version
8080 TAG_TEMPLATE : ${{ inputs.tag_template }}
8181 PRODUCT_NAME : ${{ inputs.product_name }}
8282 DRY_RUN : ${{ inputs.dry_run }}
83+ FOLLOWING_VERSION : ${{ inputs.following_version }}
8384 # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
8485 - name : Publish distribution 📦 to PyPI
8586 if : inputs.dry_run == 'false'
@@ -107,11 +108,11 @@ runs:
107108 uses : mongodb-labs/drivers-github-tools/bump-version@v2
108109 if : inputs.dry_run == 'false'
109110 with :
110- version : ${{ inputs .following_version }}
111+ version : ${{ steps.publish-script.outputs .following_version }}
111112 version_bump_script : ${{ inputs.version_bump_script }}
112113 working_directory : ${{ inputs.working_directory }}
113114 - name : Skip Setting following version
114115 shell : bash
115116 if : inputs.dry_run == 'true'
116117 run : |
117- echo "Dry run, not setting the following version: ${{ inputs .following_version }}" >> $GITHUB_STEP_SUMMARY
118+ echo "Dry run, not setting the following version: ${{ steps.publish-script.outputs .following_version }}" >> $GITHUB_STEP_SUMMARY
Original file line number Diff line number Diff line change 1+ import sys
2+ from packaging .version import Version
3+
4+ version = Version (sys .argv [1 ])
5+ new_version = None
6+
7+ if version .is_devrelease :
8+ # For dev releases, increment the dev release number.
9+ new_version = f"{ version .major } .{ version .minor } .{ version .micro } .dev{ version .dev + 1 } "
10+ elif version .is_prerelease :
11+ # For pre releases, go back to dev release.
12+ rel_type , rel_num = version .pre
13+ new_version = f"{ version .major } .{ version .minor } .{ version .micro } .{ rel_type } { rel_num + 1 } "
14+ elif version .micro == 0 :
15+ # For minor releases, go to next minor release.
16+ new_version = f"{ version .major } .{ version .minor + 1 } .0.dev0"
17+ else :
18+ # For patch releases, go to the next patch release.
19+ new_version = f"{ version .major } .{ version .minor } .{ version .micro + 1 } .dev0"
20+
21+ print (str (new_version ))
Original file line number Diff line number Diff line change 22
33set -eux
44
5+ # Handle the following version.
6+ if [ -z " ${FOLLOWING_VERSION} " ]; then
7+ pip install packaging
8+ pushd $GITHUB_ACTION_PATH
9+ FOLLOWING_VERSION=$( python handle_following_version.py $VERSION )
10+ popd
11+ fi
12+ echo " following_version=$FOLLOWING_VERSION " >> $GITHUB_OUTPUT
13+
514if [ " $DRY_RUN " == " false" ]; then
615 PUSH_CHANGES=true
716 echo " Creating draft release with attached files"
You can’t perform that action at this time.
0 commit comments