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:
@@ -164,12 +164,18 @@ jobs:
|
|||||||
in_section
|
in_section
|
||||||
' "$GITHUB_WORKSPACE/CHANGELOG.md")
|
' "$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)
|
# Create the release (or get the existing one for this tag)
|
||||||
release_json=$(curl -fsSL -X POST "$api/repos/$REPO/releases" \
|
release_json=$(curl -fsSL -X POST "$api/repos/$REPO/releases" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d "$(jq -n --arg tag "$TAG" --arg name "$TAG" --arg body "$body" \
|
-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:false}')" \
|
'{tag_name:$tag,name:$name,body:$body,draft:false,prerelease:$pre}')" \
|
||||||
|| curl -fsSL "$api/repos/$REPO/releases/tags/$TAG" \
|
|| curl -fsSL "$api/repos/$REPO/releases/tags/$TAG" \
|
||||||
-H "Authorization: token $GITEA_TOKEN")
|
-H "Authorization: token $GITEA_TOKEN")
|
||||||
rid=$(echo "$release_json" | jq -r .id)
|
rid=$(echo "$release_json" | jq -r .id)
|
||||||
|
|||||||
Reference in New Issue
Block a user