diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 971445f..8c5cea0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,8 +22,8 @@ jobs: - name: Validate tag run: | - if ! echo "$VERSION_NUM" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then - echo "Tag $VERSION_NUM does not follow semantic version pattern (x.y.z). Skipping release." + if ! echo "$VERSION_NUM" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$'; then + echo "Tag $VERSION_NUM does not follow semantic version pattern (x.y.z or x.y.z-rc.N). Skipping release." exit 78 # neutral exit code fi echo "Tag $VERSION_NUM follows valid semantic version pattern" @@ -90,6 +90,13 @@ jobs: - name: Create GitHub release run: | + # Check if this is a release candidate + PRERELEASE_FLAG="" + if echo "$VERSION_NUM" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$'; then + PRERELEASE_FLAG="--prerelease" + echo "Detected release candidate version, will mark as prerelease" + fi + # Check if release already exists. Needed when release created via new release in guthub ui if gh release view "$VERSION_NUM" > /dev/null 2>&1; then echo "Release for tag $VERSION_NUM already exists, uploading additional assets..." @@ -98,7 +105,8 @@ jobs: echo "Creating new release for tag $VERSION_NUM..." gh release create "$VERSION_NUM" ./*.tar.gz \ --title "Release $VERSION_NUM" \ - --notes "Release $VERSION_NUM" + --notes "Release $VERSION_NUM" \ + $PRERELEASE_FLAG fi handle-failures: name: Handle Failures