Skip to content

Commit 01a4744

Browse files
committed
ci(release): support prerelease tags in release workflow
Extend the release trigger to match tags with a prerelease suffix (e.g. v0.2.1-rc.1). Detect the prerelease flag at runtime and pass --prerelease to gh release create so GitHub marks the release correctly.
1 parent 2d948d5 commit 01a4744

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+-*'
78

89
jobs:
910
release:
@@ -17,7 +18,15 @@ jobs:
1718

1819
- name: Extract version from tag
1920
id: version
20-
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
21+
run: |
22+
VERSION=${GITHUB_REF_NAME#v}
23+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
24+
# Mark as prerelease if version contains a hyphen (e.g. 0.3.0-rc.1)
25+
if [[ "$VERSION" == *-* ]]; then
26+
echo "prerelease=true" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "prerelease=false" >> "$GITHUB_OUTPUT"
29+
fi
2130
2231
# Build a distributable plugin ZIP.
2332
# Kanboard's plugin installer expects a ZIP containing a single root
@@ -43,7 +52,13 @@ jobs:
4352
env:
4453
GH_TOKEN: ${{ github.token }}
4554
run: |
55+
PRERELEASE_FLAG=""
56+
if [ "${{ steps.version.outputs.prerelease }}" = "true" ]; then
57+
PRERELEASE_FLAG="--prerelease"
58+
fi
59+
4660
gh release create "${{ github.ref_name }}" \
4761
--title "${{ github.ref_name }}" \
4862
--generate-notes \
63+
$PRERELEASE_FLAG \
4964
"$ARCHIVE"

0 commit comments

Comments
 (0)