Skip to content

Commit 3df94b8

Browse files
committed
(gh actions) Update version input description and add validation for version format
1 parent b05a497 commit 3df94b8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
new_version:
7-
description: 'New version number (e.g., 1.2.3)'
7+
description: 'New version number (e.g., major.minor.patch-[alpha|beta|rc].N.postN)'
88
required: true
99

1010
jobs:
@@ -31,7 +31,10 @@ jobs:
3131
run: pip install bump2version
3232

3333
- name: Bump version
34-
run: |
34+
if [[ ! "${{ github.event.inputs.new_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[alpha|beta|rc]\.[0-9]+)?(\.post[0-9]+)?$ ]]; then
35+
echo "Error: New version does not match the required format (e.g., major.minor.patch-[alpha|beta|rc].N.postN)." >&2
36+
exit 1
37+
fi
3538
bumpversion --new-version ${{ github.event.inputs.new_version }} --no-commit --no-tag minor
3639

3740
- name: Commit and tag version

0 commit comments

Comments
 (0)