Release script: mark pre-1.0.0 releases as pre-release
Flag any release with major version 0 as a Forgejo pre-release on create, and PATCH the flag on re-runs so it stays correct. Existing v0.1.0/v0.2.0/v0.3.0 releases were updated to pre-release too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
dd1cc0ccdf
commit
7c10a92475
2 changed files with 11 additions and 4 deletions
|
|
@ -7,7 +7,8 @@ single running list until the first versioned release.
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
_Nothing yet._
|
- **Release script** now flags every release before v1.0.0 as a **pre-release**
|
||||||
|
(and corrects the flag on re-runs).
|
||||||
|
|
||||||
## 0.3.0
|
## 0.3.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,18 @@ try:
|
||||||
d=json.load(sys.stdin); print(d.get("id","") if isinstance(d,dict) else "")
|
d=json.load(sys.stdin); print(d.get("id","") if isinstance(d,dict) else "")
|
||||||
except Exception:
|
except Exception:
|
||||||
print("")')"
|
print("")')"
|
||||||
|
# Everything before v1.0.0 is flagged as a pre-release.
|
||||||
|
if [ "${VER%%.*}" = "0" ]; then PRERELEASE=true; else PRERELEASE=false; fi
|
||||||
|
|
||||||
if [ -z "$ID" ]; then
|
if [ -z "$ID" ]; then
|
||||||
BODY="$(python3 -c 'import json,sys; print(json.dumps({"tag_name":sys.argv[1],"name":"FreeTRX "+sys.argv[1],"body":sys.argv[2],"draft":False,"prerelease":False}))' "$TAG" "$NOTES")"
|
BODY="$(python3 -c 'import json,sys; print(json.dumps({"tag_name":sys.argv[1],"name":"FreeTRX "+sys.argv[1],"body":sys.argv[2],"draft":False,"prerelease":(sys.argv[3]=="true")}))' "$TAG" "$NOTES" "$PRERELEASE")"
|
||||||
ID="$(curl -fsS -X POST "$API/releases" -H "Authorization: token $FORGEJO_TOKEN" -H "Content-Type: application/json" -d "$BODY" | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])')"
|
ID="$(curl -fsS -X POST "$API/releases" -H "Authorization: token $FORGEJO_TOKEN" -H "Content-Type: application/json" -d "$BODY" | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])')"
|
||||||
echo "==> Created release $TAG (id=$ID)"
|
echo "==> Created release $TAG (id=$ID, prerelease=$PRERELEASE)"
|
||||||
else
|
else
|
||||||
echo "==> Reusing existing release $TAG (id=$ID)"
|
# Keep the pre-release flag correct on re-runs.
|
||||||
|
curl -fsS -X PATCH "$API/releases/$ID" -H "Authorization: token $FORGEJO_TOKEN" -H "Content-Type: application/json" \
|
||||||
|
-d "$(python3 -c 'import json,sys; print(json.dumps({"prerelease":(sys.argv[1]=="true")}))' "$PRERELEASE")" >/dev/null
|
||||||
|
echo "==> Reusing existing release $TAG (id=$ID, prerelease=$PRERELEASE)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Attach each staged binary, replacing an existing asset of the same name.
|
# Attach each staged binary, replacing an existing asset of the same name.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue