Skip to content

Commit 8c8a2e2

Browse files
committed
Bump to the correct next semantic version
1 parent c90927b commit 8c8a2e2

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/workflows/finalize-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
GH_TOKEN: ${{ github.token }}
7979
run: |
8080
version=${BASE_REF#rc/}
81-
next_version="$version-dev"
81+
next_version=$(python scripts/release/next-version.py --component minor --pre-release dev -- $version)
8282
echo "Bumping main version to $next_version"
8383
8484
git switch main

scripts/release/next-version.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from semantic_version import Version
2+
import argparse
3+
4+
parser = argparse.ArgumentParser(description='Prints the next release version')
5+
parser.add_argument('-c', '--component', default="minor", help='The component to increment (major, minor, patch)')
6+
parser.add_argument('-p', '--pre-release', nargs='*', help='The pre-release label(s) (e.g. alpha, dev). Multiple labels can be specified so separate the options and the version using `--`!')
7+
parser.add_argument('-b', '--build', nargs='*', help='The build identifier(s). Multiple identifiers can be specified so separate the options and the version using `--`!')
8+
parser.add_argument('current_version', type=Version, help='The current version')
9+
10+
if __name__ == "__main__":
11+
args = parser.parse_args()
12+
version : Version = args.current_version
13+
next_version = None
14+
if args.component== "major":
15+
next_version = version.next_major()
16+
elif args.component == "minor":
17+
next_version = version.next_minor()
18+
elif args.component == "patch":
19+
next_version = version.next_patch()
20+
else:
21+
raise ValueError(f"Invalid release type: {args.release_type}")
22+
23+
if args.pre_release:
24+
next_version.prerelease = args.pre_release
25+
if args.build:
26+
next_version.build = args.build
27+
28+
print(next_version)

0 commit comments

Comments
 (0)