Skip to content

Commit 04447f8

Browse files
committed
correctly use rc
1 parent 9bd14e1 commit 04447f8

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

.github/workflows/python-release.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,36 @@ name: "Python Build Release Candidate"
2222
on:
2323
push:
2424
tags:
25-
# Trigger this workflow when tag follows the versioning format: <major>.<minor>.<patch>rc<release_candidate>
26-
# Example valid tags: 0.8.1rc1, 1.0.0rc2
27-
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
25+
# Trigger this workflow when tag follows the versioning format: pyiceberg-<major>.<minor>.<patch>rc<release_candidate>
26+
# Example valid tags: pyiceberg-0.8.0rc2, pyiceberg-1.0.0rc1
27+
- 'pyiceberg-[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
2828
workflow_dispatch:
2929
inputs:
3030
version:
3131
description: 'Version (e.g., 0.8.0)'
3232
type: string
3333
required: true
3434
rc:
35-
description: 'Release Candidate (RC) (e.g., rc1)'
36-
type: string
35+
description: 'Release Candidate (RC) (e.g., 1)'
36+
type: number
3737
required: true
3838

3939
jobs:
4040
validate-inputs:
4141
runs-on: ubuntu-latest
4242
outputs:
43-
VERSION: ${{ steps.validate-inputs.outputs.VERSION }}
44-
RC: ${{ steps.validate-inputs.outputs.RC }}
43+
VERSION: ${{ steps.validate-inputs.outputs.VERSION }} # e.g. 0.8.0
44+
RC: ${{ steps.validate-inputs.outputs.RC }} # e.g. 1
4545
steps:
4646
- name: Validate and Extract Version and RC
4747
id: validate-inputs
4848
run: |
4949
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
5050
echo "Workflow triggered by tag push."
5151
TAG=${GITHUB_REF#refs/tags/} # Extract the tag name
52-
VERSION=${TAG%rc*} # Extract version by removing everything after "rc"
53-
RC=${TAG#*rc} # Extract RC by removing everything before "rc"
52+
VERSION_AND_RC=${TAG#pyiceberg-} # Remove the 'pyiceberg-' prefix
53+
VERSION=${VERSION_AND_RC%rc*} # Extract VERSION by removing everything after 'rc'
54+
RC=${VERSION_AND_RC#*rc} # Extract RC by keeping everything after 'rc'
5455
5556
if [[ -z "$VERSION" || -z "$RC" ]]; then
5657
echo "Error: Unable to parse VERSION or RC from tag ($TAG). Ensure the tag format is correct."
@@ -63,15 +64,11 @@ jobs:
6364
6465
# Validate version (e.g., 1.0.0)
6566
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
66-
echo "Error: version ($VERSION) must be in the format <number>.<number>.<number>"
67+
echo "Error: version ($VERSION) must be in the format: <number>.<number>.<number>"
6768
exit 1
6869
fi
6970
70-
# Validate rc (e.g., rc1)
71-
if [[ ! "$RC" =~ ^rc[0-9]+$ ]]; then
72-
echo "Error: rc ($RC) must be in the format rc<number>"
73-
exit 1
74-
fi
71+
# RC is already validated as a number via workflow_dispatch inputs
7572
fi
7673
7774
# Export variables for future steps
@@ -80,8 +77,8 @@ jobs:
8077
8178
- name: Display Extracted Version and RC
8279
run: |
83-
echo "Using Version: $VERSION"
84-
echo "Using RC: $RC"
80+
echo "Using Version: ${{ steps.validate-inputs.outputs.VERSION }}"
81+
echo "Using RC: ${{ steps.validate-inputs.outputs.RC }}"
8582
8683
validate-library-version:
8784
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)