release: mark v0.* tags as prerelease per SemVer convention

Pre-1.0 releases get the prerelease flag in Gitea — pre-1.0 means
public API may break between minors (SemVer permits this), so these
shouldn't display as stable releases.

Computed from $TAG via `case` so the flag auto-flips to false when
v1.0.0 lands; no further workflow change needed at that point.

  case "$TAG" in
      v0.*) prerelease=true ;;
      *)    prerelease=false ;;
  esac

Passed to jq via --argjson (not --arg) so it stays a JSON boolean
rather than the string "true" / "false".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 12:48:19 +02:00
parent 936c1f7e15
commit f7c1a3e771

View File

@@ -164,12 +164,18 @@ jobs:
in_section
' "$GITHUB_WORKSPACE/CHANGELOG.md")
# Pre-1.0 tags are prerelease per SemVer convention.
case "$TAG" in
v0.*) prerelease=true ;;
*) prerelease=false ;;
esac
# Create the release (or get the existing one for this tag)
release_json=$(curl -fsSL -X POST "$api/repos/$REPO/releases" \
-H "Authorization: token $GITEA_TOKEN" \
-H 'Content-Type: application/json' \
-d "$(jq -n --arg tag "$TAG" --arg name "$TAG" --arg body "$body" \
'{tag_name:$tag,name:$name,body:$body,draft:false,prerelease:false}')" \
-d "$(jq -n --arg tag "$TAG" --arg name "$TAG" --arg body "$body" --argjson pre "$prerelease" \
'{tag_name:$tag,name:$name,body:$body,draft:false,prerelease:$pre}')" \
|| curl -fsSL "$api/repos/$REPO/releases/tags/$TAG" \
-H "Authorization: token $GITEA_TOKEN")
rid=$(echo "$release_json" | jq -r .id)