feat: offline flavor without sync or network access (#39)
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
# TAG, SHA vX.Y.Z[-beta.N] and the commit it marks
|
||||
# PRERELEASE true | false
|
||||
# NOTES_FILE release notes (scripts/release_notes.sh)
|
||||
# APK the signed release APK
|
||||
# APK the signed release APK (full flavor)
|
||||
# APK_OFFLINE optional: the signed offline-flavor APK (issue #39)
|
||||
set -euo pipefail
|
||||
if [ -z "${TOKEN:-}" ]; then
|
||||
echo "CODEBERG_RELEASE_TOKEN not set — skipping Codeberg publish."
|
||||
@@ -27,10 +28,19 @@ if [ ! -f "$APK" ]; then echo "No release APK at $APK." >&2; exit 1; fi
|
||||
WORK=$(mktemp -d)
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
# The full APK keeps its historical name: Obtainium filters point at it.
|
||||
ASSET_APK="agendula_${TAG}.apk"
|
||||
ASSET_SUM="${ASSET_APK}.sha256"
|
||||
cp "$APK" "$WORK/$ASSET_APK"
|
||||
( cd "$WORK" && sha256sum "$ASSET_APK" > "$ASSET_SUM" )
|
||||
ASSETS=("$ASSET_APK" "$ASSET_SUM")
|
||||
if [ -n "${APK_OFFLINE:-}" ]; then
|
||||
if [ ! -f "$APK_OFFLINE" ]; then echo "No offline APK at $APK_OFFLINE." >&2; exit 1; fi
|
||||
ASSET_OFFLINE="agendula-offline_${TAG}.apk"
|
||||
cp "$APK_OFFLINE" "$WORK/$ASSET_OFFLINE"
|
||||
( cd "$WORK" && sha256sum "$ASSET_OFFLINE" > "$ASSET_OFFLINE.sha256" )
|
||||
ASSETS+=("$ASSET_OFFLINE" "$ASSET_OFFLINE.sha256")
|
||||
fi
|
||||
|
||||
# Push the tag to Codeberg ourselves. Under Codeberg-canonical the mirror runs
|
||||
# Codeberg -> Gitea, so waiting for a tag to arrive from Gitea (what 0.3.2 did)
|
||||
@@ -84,8 +94,8 @@ for attempt in 1 2 3 4 5 6; do
|
||||
done
|
||||
if [ -z "$ID" ]; then echo "Could not resolve Codeberg release id after retries." >&2; exit 1; fi
|
||||
|
||||
# Attach APK + checksum, replacing any prior asset of the same name.
|
||||
for A in "$ASSET_APK" "$ASSET_SUM"; do
|
||||
# Attach APKs + checksums, replacing any prior asset of the same name.
|
||||
for A in "${ASSETS[@]}"; do
|
||||
OLD=$(curl -s -H "Authorization: token $TOKEN" "$API/releases/$ID/assets" \
|
||||
| jq -r --arg n "$A" '.[] | select(.name==$n) | .id')
|
||||
[ -n "$OLD" ] && curl -s -X DELETE -H "Authorization: token $TOKEN" "$API/releases/$ID/assets/$OLD" >/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user