Release — F-Droid repo + Gitea/Codeberg release + Play / detect (push) Successful in 8s
Release — F-Droid repo + Gitea/Codeberg release + Play / release (push) Skipped
Release — F-Droid repo + Gitea/Codeberg release + Play / play (push) Skipped
Renovate / renovate (push) Successful in 1m26s
### What this changes - New `scripts/release_gate.sh`, used by the `detect` jobs of both `release.yaml` and `beta.yaml`, decides whether the committed version still needs publishing. Tags are read by exact name via `git ls-remote` instead of Codeberg's `git/refs/tags/<name>` API. - A beta counts as done only once its Codeberg pre-release carries the APK, so a publish that failed part-way is redone by the next push of the branch. - A beta is refused unless it is newer than the latest stable tag (previously only an exact `vX.Y.Z` tag was checked). - `publish_codeberg_release.sh` fails a pre-release when `CODEBERG_RELEASE_TOKEN` is missing (stable still skips), fails on any asset upload that doesn't return 201, and no longer aborts when the asset listing returns an error. - `version_info.sh` rejects leading zeros (`1.1.0-beta.01` would have shared `beta.1`'s versionCode under a different tag). - `beta.yaml` header and `docs/RELEASING.md` updated to match. ### Why Codeberg's `git/refs/tags/<name>` matches by prefix: asking for `v1.1.0` returns 200 because `v1.1.0-beta.1` exists. Merging 1.1.0 into `main` would have logged "tag already exists" and shipped nothing while the run stayed green, and `1.1.0-beta.2` would have been refused as "already shipped stable". `release/v1.1.0` needs `main` merged in after this lands, since `beta.yaml` runs from the pushed branch's files. ### Also in here `gradle/gradle-daemon-jvm.properties` now points at JetBrains' own download URLs for JBR 21.0.11 instead of foojay. foojay dropped JetBrains 21 from its index, so the pinned package ids return 400 and CI couldn't provision the daemon JVM (unrelated to the release change, but it blocks every PR until fixed). ### Checklist - [x] No `values-*/strings.xml` touched - [x] No `versionName` / `versionCode` bump - [x] `CHANGELOG.md` not updated: release infrastructure, not a user-visible change Co-authored-by: Jean-Luc Makiola <business@jeanlucmakiola.de> Reviewed-on: https://codeberg.org/jlmakiola/agendula/pulls/40
60 lines
2.1 KiB
Bash
Executable File
60 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Decides whether the committed version still needs publishing; prints cut=true|false.
|
|
#
|
|
# stable: no vX.Y.Z tag on Codeberg yet.
|
|
# beta: its Codeberg pre-release doesn't carry the APK yet, so a failed
|
|
# publish is redone by the next push. Refused unless it is newer than
|
|
# every shipped stable release.
|
|
#
|
|
# Fails on any lookup error rather than guessing.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.." # repo root
|
|
|
|
REPO=${REPO:-jlmakiola/agendula}
|
|
VERSION=$(bash scripts/version_info.sh version)
|
|
BASE=$(bash scripts/version_info.sh base_version)
|
|
CHANNEL=$(bash scripts/version_info.sh channel)
|
|
|
|
# Exact tag names. The Codeberg git/refs/tags/<name> API matches by prefix.
|
|
TAGS=$(git ls-remote --tags --refs "https://codeberg.org/$REPO.git" | sed 's#.*refs/tags/##')
|
|
|
|
if [ "$CHANNEL" = stable ]; then
|
|
if grep -qxF "v$VERSION" <<<"$TAGS"; then
|
|
echo "Tag v$VERSION already exists on Codeberg — nothing to release." >&2
|
|
echo "cut=false"
|
|
else
|
|
echo "No tag for v$VERSION on Codeberg yet — cutting the release." >&2
|
|
echo "cut=true"
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
LATEST=$(grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' <<<"$TAGS" | sed 's/^v//' | sort -V | tail -n1 || true)
|
|
if [ -n "$LATEST" ] && [ "$(printf '%s\n%s\n' "$BASE" "$LATEST" | sort -V | tail -n1)" = "$LATEST" ]; then
|
|
echo "Beta $VERSION is not newer than the shipped stable $LATEST — bump the version." >&2
|
|
exit 1
|
|
fi
|
|
|
|
ASSET="agendula_v${VERSION}.apk"
|
|
BODY=$(mktemp); trap 'rm -f "$BODY"' EXIT
|
|
STATUS=$(curl -s -o "$BODY" -w '%{http_code}' "https://codeberg.org/api/v1/repos/$REPO/releases/tags/v$VERSION" || echo 000)
|
|
case "$STATUS" in
|
|
200)
|
|
if grep -qF "\"name\":\"$ASSET\"" "$BODY"; then
|
|
echo "Pre-release v$VERSION already carries $ASSET — nothing to do." >&2
|
|
echo "cut=false"
|
|
else
|
|
echo "Pre-release v$VERSION exists without $ASSET — publishing it again." >&2
|
|
echo "cut=true"
|
|
fi
|
|
;;
|
|
404)
|
|
echo "No pre-release for v$VERSION yet — cutting the beta." >&2
|
|
echo "cut=true"
|
|
;;
|
|
*)
|
|
echo "Codeberg release lookup for v$VERSION returned HTTP $STATUS — refusing to guess." >&2
|
|
exit 1
|
|
;;
|
|
esac
|