diff options
| author | Tom Cooks <tommasogagliardi+github@gmail.com> | 2026-11-16 09:36:04 -0500 |
|---|---|---|
| committer | Tom Cooks <tommasogagliardi+github@gmail.com> | 2026-11-16 09:36:04 -0500 |
| commit | 7cb19d30f08259bf20faa286c20879bd851ec938 (patch) | |
| tree | e17e7969ee1119e407db8b1428a46c4539b54981 | |
| parent | 287490e0df7feb49e64f6aef1ca0a6657fcecaa7 (diff) | |
| download | reccoon-7cb19d30f08259bf20faa286c20879bd851ec938.tar.gz | |
Add the F-Droid version-update helper and record 1.1.2 status
| -rw-r--r-- | FDROID.md | 23 | ||||
| -rwxr-xr-x | tools/update-fdroid.sh | 132 |
2 files changed, 150 insertions, 5 deletions
@@ -5,8 +5,8 @@ everything around the F-Droid submission that is not in the code. ## Status -- App: **RECCoon**, application id `com.tomcooks.reccoon`, version **1.0.0** - (versionCode 1). +- App: **RECCoon**, application id `com.tomcooks.reccoon`. Published version + **1.0.0** (versionCode 1); **1.1.2** is prepared for the next update. - Source: <https://git.tomcooks.com/reccoon> (cgit; push over SSH as `wuhei`). - **F-Droid: MERGED.** MR <https://gitlab.com/fdroid/fdroiddata/-/merge_requests/51981> was merged by @@ -41,6 +41,19 @@ everything around the F-Droid submission that is not in the code. Silero VAD file still comes from the moving GitHub `asr-models` release; deferred to 1.0.1 (pin with a SHA-256 next to `VAD_BYTES`). +## 1.1.2 release — source done, F-Droid MR pending + +- Source release: tag `v1.1.2` → `5090b55eb7bc3a98b678e21b859fd01d2e30e554`, + pushed to `origin/main`. +- Signed APK: `releases/RECCoon-1.1.2.apk` (tracked). The Binaries URL + <https://git.tomcooks.com/reccoon/plain/releases/RECCoon-1.1.2.apk> returns 200. +- fdroiddata metadata: `f-droid/com.tomcooks.reccoon.yml` now lists the + `1.1.2` / versionCode 4 build and sets `CurrentVersion: 1.1.2`. +- **F-Droid MR: not opened yet.** The saved token in `~/.config/gitlab-token` + returned `401 invalid_token` (expired). Renew an `api`-scoped token, save it, + then run `./tools/update-fdroid.sh`; it opens the MR against + `fdroid/fdroiddata`. + ## Signing key — DO NOT LOSE - Keystore: `/home/wuhei/dev/reccoon-keystore/reccoon-release.jks`, alias `reccoon`. @@ -59,9 +72,9 @@ everything around the F-Droid submission that is not in the code. (also copied to `dist/`). 3. `git add -A && git commit`, then tag `v<version>` and push `main` + the tag: `git tag -a v1.0.1 -m "RECCoon 1.0.1" && git push origin main v1.0.1`. -4. Update `commit:` in `f-droid/com.tomcooks.reccoon.yml` to the new tag hash and - push it to the fdroiddata MR (edit the file on branch `reccoon`), or run - `./tools/submit-to-fdroid.sh` if starting a fresh MR. +4. Update `commit:` in `f-droid/com.tomcooks.reccoon.yml` to the new tag hash, + commit and push it, then run `./tools/update-fdroid.sh` to open/update the + fdroiddata MR. Use `./tools/submit-to-fdroid.sh` only for a first submission. 5. Comment on the MR and ask `linsui` to re-trigger the pipeline. ## Signing / build gotchas (why it is set up this way) diff --git a/tools/update-fdroid.sh b/tools/update-fdroid.sh new file mode 100755 index 0000000..3500348 --- /dev/null +++ b/tools/update-fdroid.sh @@ -0,0 +1,132 @@ +#!/usr/bin/env bash +# Open/update the fdroiddata merge request for the current RECCoon release. +# +# The app is already in F-Droid; this updates metadata/com.tomcooks.reccoon.yml +# with the build entry from f-droid/com.tomcooks.reccoon.yml and opens an MR +# against fdroid/fdroiddata. +# +# Needs a GitLab Personal Access Token with the "api" scope: +# printf '%s' 'glpat-...' > ~/.config/gitlab-token +# chmod 600 ~/.config/gitlab-token +# +# The release tag and signed APK must already be pushed to the source repo. +set -euo pipefail +cd "$(dirname "$0")/.." + +API="https://gitlab.com/api/v4" +UPSTREAM_PATH="fdroid%2Ffdroiddata" +FILE_PATH="metadata/com.tomcooks.reccoon.yml" +FILE_PATH_ENC="metadata%2Fcom.tomcooks.reccoon.yml" +SOURCE_YAML="f-droid/com.tomcooks.reccoon.yml" + +TOKEN="${GITLAB_TOKEN:-}" +if [ -z "$TOKEN" ] && [ -f "$HOME/.config/gitlab-token" ]; then + TOKEN="$(tr -d '\r\n' < "$HOME/.config/gitlab-token")" +fi +if [ -z "$TOKEN" ]; then + echo "No GitLab token found. See the comment at the top of this script." >&2 + exit 1 +fi +if [ ! -f "$SOURCE_YAML" ]; then + echo "Missing $SOURCE_YAML" >&2 + exit 1 +fi + +gl() { curl -sf -H "PRIVATE-TOKEN: $TOKEN" "$@"; } + +VERSION="$(sed -nE 's/^CurrentVersion: *(.*)$/\1/p' "$SOURCE_YAML" | head -1)" +BRANCH="reccoon-${VERSION}" +if [ -z "$VERSION" ]; then + echo "Could not read CurrentVersion from $SOURCE_YAML" >&2 + exit 1 +fi + +AUTH_CODE="$(curl -s -o /tmp/fdroid-user.json -w '%{http_code}' \ + -H "PRIVATE-TOKEN: $TOKEN" "$API/user")" +if [ "$AUTH_CODE" != "200" ]; then + echo "GitLab authentication failed (HTTP $AUTH_CODE)." >&2 + cat /tmp/fdroid-user.json >&2 + echo "Renew the token at https://gitlab.com/-/user_settings/personal_access_tokens" >&2 + echo "with the api scope, then save it to ~/.config/gitlab-token." >&2 + exit 1 +fi +USERNAME="$(jq -r .username /tmp/fdroid-user.json)" +UPSTREAM_ID="$(gl "$API/projects/$UPSTREAM_PATH" | jq -r .id)" +TARGET_BRANCH="$(gl "$API/projects/$UPSTREAM_PATH" | jq -r .default_branch)" +echo "Authenticated as @$USERNAME; target branch $TARGET_BRANCH; release $VERSION" + +echo "==> Checking fork" +PROJ="$(gl "$API/projects/$USERNAME%2Ffdroiddata" 2>/dev/null || true)" +FORK_ID="$(printf '%s' "$PROJ" | jq -r '.id // empty' 2>/dev/null || true)" +if [ -z "$FORK_ID" ]; then + echo " creating fork (this can take a few minutes)" + curl -s -o /dev/null -H "PRIVATE-TOKEN: $TOKEN" -X POST \ + "$API/projects/$UPSTREAM_PATH/fork" || true + for _ in $(seq 1 180); do + PROJ="$(gl "$API/projects/$USERNAME%2Ffdroiddata" 2>/dev/null || true)" + FORK_ID="$(printf '%s' "$PROJ" | jq -r '.id // empty' 2>/dev/null || true)" + EMPTY="$(printf '%s' "$PROJ" | jq -r '.empty_repo // true' 2>/dev/null || true)" + if [ -n "$FORK_ID" ] && [ "$EMPTY" = "false" ]; then + break + fi + sleep 5 + done +fi +if [ -z "$FORK_ID" ]; then + echo "Fork is not ready; run this script again in a minute." >&2 + exit 1 +fi +FORK_BRANCH="$(printf '%s' "$PROJ" | jq -r '.default_branch // "master"')" +echo " fork id: $FORK_ID (default branch $FORK_BRANCH)" + +echo "==> Creating branch $BRANCH from $FORK_BRANCH" +curl -s -o /dev/null -H "PRIVATE-TOKEN: $TOKEN" -X POST \ + "$API/projects/$FORK_ID/repository/branches?branch=$BRANCH&ref=$FORK_BRANCH" || true + +echo "==> Writing $FILE_PATH" +CONTENT="$(cat "$SOURCE_YAML")" +LAST_COMMIT="" +LAST_COMMIT="$(gl "$API/projects/$FORK_ID/repository/files/$FILE_PATH_ENC?ref=$BRANCH" \ + | jq -r '.last_commit_id // empty' 2>/dev/null || true)" +BODY="$(jq -n --arg b "$BRANCH" --arg c "$CONTENT" --arg m "Update RECCoon to $VERSION" \ + --arg l "$LAST_COMMIT" \ + '{branch:$b, content:$c, commit_message:$m} + (if $l == "" then {} else {last_commit_id:$l} end)')" +if [ -n "$LAST_COMMIT" ]; then + CODE="$(curl -s -o /tmp/fdroid-file.json -w '%{http_code}' \ + -H "PRIVATE-TOKEN: $TOKEN" -H 'Content-Type: application/json' \ + -X PUT "$API/projects/$FORK_ID/repository/files/$FILE_PATH_ENC" -d "$BODY")" +else + CODE="$(curl -s -o /tmp/fdroid-file.json -w '%{http_code}' \ + -H "PRIVATE-TOKEN: $TOKEN" -H 'Content-Type: application/json' \ + -X POST "$API/projects/$FORK_ID/repository/files/$FILE_PATH_ENC" -d "$BODY")" +fi +if [ "$CODE" != "200" ] && [ "$CODE" != "201" ]; then + echo " unexpected response (HTTP $CODE):" >&2 + cat /tmp/fdroid-file.json >&2 + exit 1 +fi + +echo "==> Checking for an existing merge request" +EXISTING="$(gl "$API/projects/$FORK_ID/merge_requests?source_branch=$BRANCH&state=opened" \ + | jq -r '.[0].web_url // empty')" +if [ -n "$EXISTING" ]; then + echo " already open: $EXISTING" + exit 0 +fi + +echo "==> Opening merge request" +MR_BODY="$(jq -n --arg b "$BRANCH" --arg base "$TARGET_BRANCH" --argjson up "$UPSTREAM_ID" \ + --arg v "$VERSION" \ + '{source_branch:$b, target_branch:$base, target_project_id:$up, + title:("Update RECCoon to " + $v), + description:("Update RECCoon to " + $v + ".\n\n- Source: https://git.tomcooks.com/reccoon\n- Signed APK: https://git.tomcooks.com/reccoon/plain/releases/RECCoon-" + $v + ".apk\n- Release tag: v" + $v)}')" +MR_CODE="$(curl -s -o /tmp/fdroid-mr.json -w '%{http_code}' \ + -H "PRIVATE-TOKEN: $TOKEN" -H 'Content-Type: application/json' \ + -X POST "$API/projects/$FORK_ID/merge_requests" -d "$MR_BODY")" +if [ "$MR_CODE" = "201" ]; then + echo " merge request: $(jq -r .web_url /tmp/fdroid-mr.json)" +else + echo " response (HTTP $MR_CODE):" >&2 + cat /tmp/fdroid-mr.json >&2 + exit 1 +fi |
