Skip to content

Commit 209399f

Browse files
committed
fix: update tag patterns to support pre-release versions in workflows
1 parent 8dc7211 commit 209399f

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

.github/workflows/create-release.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ on:
44
push:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
7-
- "v[0-9]+.[0-9]+.[0-9]+*"
7+
- "v[0-9]+.[0-9]+.[0-9]+[a-zA-Z]+[0-9]*"
88
workflow_dispatch:
9+
inputs:
10+
tag:
11+
description: "Tag to create release for (e.g., v1.0.0rc1)"
12+
required: true
13+
type: string
914

1015
jobs:
1116
create-release:
@@ -21,25 +26,35 @@ jobs:
2126
- name: Extract version information
2227
id: version_info
2328
run: |
24-
VERSION="${{ github.ref_name }}"
29+
# Determine version based on trigger type
30+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
31+
VERSION="${{ github.event.inputs.tag }}"
32+
else
33+
VERSION="${{ github.ref_name }}"
34+
fi
35+
2536
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
echo "Detected version: $VERSION"
2638
2739
# Check if current version is pre-release (e.g. alpha / beta / rc)
28-
if [[ "$VERSION" =~ ([a-zA-Z]+)([0-9]*)?$ ]]; then
40+
if [[ "$VERSION" =~ v[0-9]+\.[0-9]+\.[0-9]+([a-zA-Z]+[0-9]*)$ ]]; then
2941
echo "is_prerelease=true" >> $GITHUB_OUTPUT
3042
echo "prerelease_tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
3143
echo "release_name=$VERSION" >> $GITHUB_OUTPUT
44+
echo "Detected as prerelease with tag: ${BASH_REMATCH[1]}"
3245
else
3346
echo "is_prerelease=false" >> $GITHUB_OUTPUT
3447
echo "prerelease_tag=" >> $GITHUB_OUTPUT
3548
echo "release_name=$VERSION" >> $GITHUB_OUTPUT
49+
echo "Detected as stable release"
3650
fi
3751
3852
- name: Extract changelog content
3953
id: changelog
4054
run: |
4155
# https://medium.com/%40usman_qb/from-git-tag-to-github-release-automating-changelog-extraction-9cfcad1b13c4
42-
VERSION="${{ github.ref_name }}"
56+
# Get version from previous step
57+
VERSION="${{ steps.version_info.outputs.version }}"
4358
# Remove 'v' prefix if it exists for matching changelog
4459
VERSION_NUMBER="${VERSION#v}"
4560

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
7-
- "v[0-9]+.[0-9]+.[0-9]+*"
7+
- "v[0-9]+.[0-9]+.[0-9]+[a-zA-Z]+[0-9]"
88
workflow_dispatch:
99

1010
jobs:

0 commit comments

Comments
 (0)