Debloat your Android TV, install apps, browse and transfer files on it, all from your phone. Just 3 MB, no tracking, no root, no PC.
Add the dev/main release flow
jesse-agent-3620bdf7bf41f2f
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSnew file mode 100644index 0000000..2d01009--- /dev/null+++ b/.github/CODEOWNERS@@ -0,0 +1,2 @@+# Every change to main or dev needs the maintainer's review.+* @man15hdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 07892e6..91676b7 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -3,7 +3,7 @@ name: CIon:pull_request:push:- branches: [main]+ branches: [main, dev]permissions:contents: readdiff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.ymlnew file mode 100644index 0000000..110ac90--- /dev/null+++ b/.github/workflows/release-check.yml@@ -0,0 +1,60 @@+name: Release check++on:+ pull_request:+ branches: [main]++permissions:+ contents: read++jobs:+ # main only takes dev from this repo. The test lives in the `if`, not in+ # `run:`, so the branch name never reaches a shell.+ only-dev-to-main:+ if: github.head_ref != 'dev' || github.event.pull_request.head.repo.full_name != github.repository+ runs-on: ubuntu-latest+ steps:+ - name: Refuse+ run: |+ echo "::error::PRs into main must come from dev"+ exit 1++ # Every release is deliberate: a PR into main must raise versionName and+ # versionCode past the latest v* tag and add the version's CHANGELOG.md section.+ version-bumped:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v7+ with:+ fetch-depth: 0 # the tags++ - name: Version is past the latest tag+ run: |+ name() { sed -nE 's/^ *versionName = "([^"]+)".*/\1/p'; }+ code() { sed -nE 's/^ *versionCode = ([0-9]+).*/\1/p'; }+ VERSION=$(name < app/build.gradle.kts)+ CODE=$(code < app/build.gradle.kts)+ if [ -z "$VERSION" ] || [ -z "$CODE" ]; then+ echo "::error::Could not read versionName/versionCode from app/build.gradle.kts"+ exit 1+ fi+ if ! grep -qE "^## $(printf '%s' "$VERSION" | sed 's/\./\\./g')( |$)" CHANGELOG.md; then+ echo "::error::CHANGELOG.md has no '## $VERSION — YYYY-MM-DD' section"+ exit 1+ fi+ LATEST=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//' | sort -V | tail -n 1)+ if [ -z "$LATEST" ]; then+ echo "No release tag yet; $VERSION ($CODE) passes."+ exit 0+ fi+ LATEST_CODE=$(git show "v$LATEST:app/build.gradle.kts" | code)+ HIGHEST=$(printf '%s\n%s\n' "$VERSION" "$LATEST" | sort -V | tail -n 1)+ if [ "$VERSION" = "$LATEST" ] || [ "$HIGHEST" != "$VERSION" ]; then+ echo "::error::versionName is $VERSION, latest release is v$LATEST. Raise it in app/build.gradle.kts and add its CHANGELOG.md section"+ exit 1+ fi+ if [ "$CODE" -le "${LATEST_CODE:-0}" ]; then+ echo "::error::versionCode is $CODE, v$LATEST shipped $LATEST_CODE. Raise it in app/build.gradle.kts"+ exit 1+ fi+ echo "$VERSION ($CODE) is past v$LATEST ($LATEST_CODE)."diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 0000000..84a6a80--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,151 @@+name: Release++on:+ push:+ branches: [dev, main]++permissions:+ contents: read++concurrency:+ group: release-${{ github.ref }}+ cancel-in-progress: false++jobs:+ # Rolling alpha: every push to dev replaces the `alpha` pre-release.+ # app.tellyscope.alpha installs next to the release build.+ alpha:+ if: github.ref == 'refs/heads/dev'+ runs-on: ubuntu-latest+ timeout-minutes: 30+ permissions:+ contents: write+ steps:+ - uses: actions/checkout@v7+ with:+ fetch-depth: 0 # the tags++ # JDK 25: Kadb ships Java 25 bytecode.+ - uses: actions/setup-java@v6+ with:+ distribution: temurin+ java-version: 25++ - uses: gradle/actions/setup-gradle@v6++ - name: Keystore+ env:+ RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}+ run: |+ if [ -z "$RELEASE_KEYSTORE_BASE64" ]; then+ echo "::error::Repo secret RELEASE_KEYSTORE_BASE64 is not set; see CONTRIBUTING.md#releases"+ exit 1+ fi+ printf '%s' "$RELEASE_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"++ - name: Build+ env:+ RELEASE_KEYSTORE: ${{ runner.temp }}/release.jks+ RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}+ RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}+ RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}+ run: ./gradlew :app:assembleRelease -Ptellyscope.alpha=${{ github.run_number }} --console=plain++ - name: Alpha pre-release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ RUN: ${{ github.run_number }}+ run: |+ V="$(sed -nE 's/^ *versionName = "([^"]+)".*/\1/p' app/build.gradle.kts)-alpha.$RUN"+ APK="Tellyscope-alpha.apk" # fixed name, so the download link never changes+ cp app/build/outputs/apk/release/app-release.apk "$APK"+ PREV=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)+ {+ echo "Alpha build $V from \`${GITHUB_SHA::7}\` on dev. Untested and may break; it installs as a separate app, \`app.tellyscope.alpha\`."+ echo+ echo "### Commits since ${PREV:-the first commit}"+ echo+ git log --no-merges --pretty='- %s (%h)' ${PREV:+"$PREV.."}HEAD+ } > notes.md+ gh release delete alpha --cleanup-tag --yes || true+ gh release create alpha "$APK" --prerelease --target "$GITHUB_SHA" \+ --title "Tellyscope $V" --notes-file notes.md++ # Prod: a merge into main tags vX.Y.Z from versionName and publishes the+ # signed APK. release-check.yml has already made sure the version is new.+ prod:+ if: github.ref == 'refs/heads/main'+ runs-on: ubuntu-latest+ timeout-minutes: 30+ permissions:+ contents: write+ steps:+ - uses: actions/checkout@v7+ with:+ fetch-depth: 0 # the tags++ - name: Version+ id: version+ run: |+ V=$(sed -nE 's/^ *versionName = "([^"]+)".*/\1/p' app/build.gradle.kts)+ echo "version=$V" >> "$GITHUB_OUTPUT"+ if git rev-parse -q --verify "refs/tags/v$V" >/dev/null; then+ echo "::notice::v$V is already released; nothing to do"+ echo "new=false" >> "$GITHUB_OUTPUT"+ else+ echo "new=true" >> "$GITHUB_OUTPUT"+ fi++ - uses: actions/setup-java@v6+ if: steps.version.outputs.new == 'true'+ with:+ distribution: temurin+ java-version: 25++ - uses: gradle/actions/setup-gradle@v6+ if: steps.version.outputs.new == 'true'++ - name: Keystore+ if: steps.version.outputs.new == 'true'+ env:+ RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}+ run: |+ if [ -z "$RELEASE_KEYSTORE_BASE64" ]; then+ echo "::error::Repo secret RELEASE_KEYSTORE_BASE64 is not set; see CONTRIBUTING.md#releases"+ exit 1+ fi+ printf '%s' "$RELEASE_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"++ - name: Build+ if: steps.version.outputs.new == 'true'+ env:+ RELEASE_KEYSTORE: ${{ runner.temp }}/release.jks+ RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}+ RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}+ RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}+ run: ./gradlew :app:assembleRelease --console=plain++ # Notes: the version's CHANGELOG.md section, then every commit since the+ # previous tag.+ - name: Tag and release+ if: steps.version.outputs.new == 'true'+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ V: ${{ steps.version.outputs.version }}+ run: |+ PREV=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)+ awk -v v="$V" '+ /^## / { if (on) exit; h = $0; sub(/^## v?/, "", h); split(h, a, /[ \t]/); on = (a[1] == v); next }+ on+ ' CHANGELOG.md > notes.md+ {+ echo+ echo "### Commits since ${PREV:-the first commit}"+ echo+ git log --no-merges --pretty='- %s (%h)' ${PREV:+"$PREV.."}HEAD+ } >> notes.md+ APK="Tellyscope-$V.apk"+ cp app/build/outputs/apk/release/app-release.apk "$APK"+ git tag "v$V"+ git push origin "v$V"+ gh release create "v$V" "$APK" --title "Tellyscope $V" --notes-file notes.md --verify-tagdiff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 0000000..2cda6d4--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,10 @@+# Changelog++What changed in each Tellyscope release, newest first. Each entry is written+for the people using the app. Headings are `## <version> — <date>`, where+`<version>` is the release's `versionName`. One line per change:+**New:**, **Improved:** or **Fixed:**, then a plain line of at most about+twelve words, ending with a link to its PR.++A pull request into `main` fails CI until this file has a section for its+version.diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex ad8d633..0bb238e 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -5,11 +5,18 @@ Thanks for helping! Tellyscope is pre-alpha, so the code and its structure are s## Ground rules- **Read the [safety rules](README.md#safety-rules) first.** A pull request that uninstalls packages, bypasses the protected list or skips the backup step won't be merged.+- **Open pull requests against `dev`.** `main` is the release branch and only takes `dev`.- **One change per pull request.** Smaller is easier to review.- **`./gradlew build` must pass** before you open a PR. CI runs the same command.- **New files start with an SPDX header:** `// SPDX-License-Identifier: GPL-3.0-only`.- **Licensing.** By contributing you agree that your work is licensed under GPL-3.0. If you adapt code or lists from another project, check that its license is compatible and add it to [NOTICE](NOTICE) in the same PR.+## Releases++- **Alpha:** every push to `dev` builds `app.tellyscope.alpha`, which installs next to the release, and replaces the `alpha` pre-release on GitHub with it.+- **Shipping:** a release is a pull request from `dev` into `main`, merged with a merge commit. It must raise `versionName` and `versionCode` in `app/build.gradle.kts` past the latest `v*` tag and add that version's section to [CHANGELOG.md](CHANGELOG.md); CI refuses anything else. Merging it tags `vX.Y.Z` and publishes a GitHub release with the signed APK, notes from the changelog section and the commits since the previous tag.+- **Signing:** CI signs both builds from four repository secrets: `RELEASE_KEYSTORE_BASE64` (the keystore, base64-encoded), `RELEASE_STORE_PASSWORD`, `RELEASE_KEY_ALIAS` and `RELEASE_KEY_PASSWORD`. Only the maintainer holds the key; never commit a keystore. Local release builds are unsigned.+## Debloat listsPackage lists are the riskiest part of the app. When you add a package:diff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex 5d42d78..1aae7d4 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -15,12 +15,34 @@ android {// phones in use. Kadb needs 23; the TV side has its own floor (wireless debugging is 11+).minSdk = 26targetSdk = 37+ // A PR into main must raise both past the latest v* tag (.github/workflows/release-check.yml).versionCode = 1versionName = "0.0.1"++ // The rolling alpha (release.yml, on dev) passes -Ptellyscope.alpha=<run number>:+ // a separate app ID, so it installs next to the release.+ providers.gradleProperty("tellyscope.alpha").orNull?.let { run ->+ applicationIdSuffix = ".alpha"+ versionNameSuffix = "-alpha.$run"+ }+ }++ // Only CI signs, from repo secrets; without RELEASE_KEYSTORE the release APK is unsigned.+ val keystore = providers.environmentVariable("RELEASE_KEYSTORE").orNull+ signingConfigs {+ if (keystore != null) {+ create("release") {+ storeFile = file(keystore)+ storePassword = providers.environmentVariable("RELEASE_STORE_PASSWORD").get()+ keyAlias = providers.environmentVariable("RELEASE_KEY_ALIAS").get()+ keyPassword = providers.environmentVariable("RELEASE_KEY_PASSWORD").get()+ }+ }}buildTypes {release {+ signingConfig = signingConfigs.findByName("release")isMinifyEnabled = trueisShrinkResources = trueproguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")