Skip to content

Commit 46bbd6a

Browse files
committed
add version and rc as inputs
1 parent 46f63c2 commit 46bbd6a

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/python-release.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,33 @@ on:
2525
version:
2626
description: 'Version'
2727
type: string
28-
default: 'main'
28+
rc:
29+
description: 'RC'
30+
type: string
2931

3032

3133
jobs:
34+
validate-inputs:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Validate Version and RC
38+
id: validate
39+
run: |
40+
# Validate version (e.g., 1.0.0)
41+
if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
42+
echo "Error: version must be in the format number.number.number"
43+
exit 1
44+
fi
45+
46+
# Validate rc (e.g., rc1)
47+
if [[ ! "${{ github.event.inputs.rc }}" =~ ^rc[0-9]+$ ]]; then
48+
echo "Error: rc must be in the format rc<number>"
49+
exit 1
50+
51+
- name: Release Version
52+
run: |
53+
echo "Running Release Version: ${{ github.event.inputs.version }}${{ github.event.inputs.rc }}"
54+
3255
build_svn_artifacts:
3356
name: Build artifacts for SVN on ${{ matrix.os }}
3457
runs-on: ${{ matrix.os }}
@@ -134,7 +157,7 @@ jobs:
134157
run: pip install poetry
135158

136159
- name: Set version
137-
run: python -m poetry version "${{ inputs.version }}" # CHANGE TO current TAG
160+
run: python -m poetry version "${{ github.event.inputs.version }}${{ github.event.inputs.rc }}" # CHANGE TO current TAG
138161

139162
# Publish the source distribution with the version that's in
140163
# the repository, otherwise the tests will fail
@@ -176,7 +199,7 @@ jobs:
176199
- name: Merge Artifacts
177200
uses: actions/upload-artifact/merge@v4
178201
with:
179-
name: "release-svn-${{ github.event.inputs.version }}"
202+
name: "release-svn-${{ github.event.inputs.version }}${{ github.event.inputs.rc }}"
180203
pattern: release-svn*
181204
delete-merged: true
182205

@@ -187,6 +210,6 @@ jobs:
187210
- name: Merge Artifacts
188211
uses: actions/upload-artifact/merge@v4
189212
with:
190-
name: "release-pypi-${{ github.event.inputs.version }}"
213+
name: "release-pypi-${{ github.event.inputs.version }}${{ github.event.inputs.rc }}"
191214
pattern: release-pypi*
192215
delete-merged: true

0 commit comments

Comments
 (0)