Skip to content

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.

Publish alphas from vX.Y.Z-alpha.N tags, not every dev push

jesse-agent-23286e460b89323
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3d7c343..941969b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -2,7 +2,9 @@ name: Release
on:
push:
- branches: [dev, main]
+ branches: [main]
+ # Alpha tags only. Prod's vX.Y.Z tags have no "-alpha." and don't match.
+ tags: ['v*-alpha.*']
permissions:
contents: read
@@ -12,10 +14,10 @@ concurrency:
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: pushing a tag like v0.1.0-alpha.1 on a dev commit publishes that
+ # tag as a pre-release. app.tellyscope.alpha installs next to the release build.
alpha:
- if: github.ref == 'refs/heads/dev'
+ if: github.ref_type == 'tag'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
@@ -23,7 +25,29 @@ jobs:
steps:
- uses: actions/checkout@v7
with:
- fetch-depth: 0 # the tags
+ fetch-depth: 0 # the tags, and dev for the check below
+
+ - name: Tag
+ id: tag
+ run: |
+ TAG="$GITHUB_REF_NAME"
+ N="${TAG##*-alpha.}"
+ if ! [[ "$N" =~ ^[1-9][0-9]*$ ]]; then
+ echo "::error::$TAG must end in -alpha.<number>, like v0.1.0-alpha.1"
+ exit 1
+ fi
+ V="${TAG#v}"; V="${V%-alpha.*}"
+ NAME=$(sed -nE 's/^ *versionName = "([^"]+)".*/\1/p' app/build.gradle.kts)
+ if [ "$V" != "$NAME" ]; then
+ echo "::error::$TAG is version $V, but versionName in app/build.gradle.kts is $NAME; tag v$NAME-alpha.<number> instead"
+ exit 1
+ fi
+ git fetch --no-tags origin +refs/heads/dev:refs/remotes/origin/dev
+ if ! git merge-base --is-ancestor "$(git rev-parse "$TAG^{commit}")" origin/dev; then
+ echo "::error::$TAG is not on dev; alpha tags go on dev commits only"
+ exit 1
+ fi
+ echo "n=$N" >> "$GITHUB_OUTPUT"
# JDK 25: Kadb ships Java 25 bytecode.
- uses: actions/setup-java@v6
@@ -48,27 +72,25 @@ jobs:
RELEASE_KEYSTORE: ${{ runner.temp }}/release.jks
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
+ run: ./gradlew :app:assembleRelease -Ptellyscope.alpha=${{ steps.tag.outputs.n }} --console=plain
- name: Alpha pre-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- RUN: ${{ github.run_number }}
+ TAG: ${{ github.ref_name }}
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
+ APK="Tellyscope-$TAG.apk"
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 "Alpha build $TAG 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
+ gh release create "$TAG" "$APK" --prerelease --verify-tag \
+ --title "Tellyscope $TAG" --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.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ff8c873..d32960d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,7 +13,7 @@ Thanks for helping! Tellyscope is pre-alpha, so the code and its structure are s
## 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.
+- **Alpha:** merging into `dev` runs CI and publishes nothing. To put out an alpha, tag a commit that is on `dev` with `vX.Y.Z-alpha.N`, where `X.Y.Z` is the current `versionName`, and push the tag. For example, with `versionName` 0.0.1: `git tag v0.0.1-alpha.1 origin/dev && git push origin v0.0.1-alpha.1`. CI builds `app.tellyscope.alpha`, which installs next to the release, and publishes it as a GitHub pre-release under that tag, named `Tellyscope-vX.Y.Z-alpha.N.apk`. The tag's `X.Y.Z` must equal `versionName` in `app/build.gradle.kts`, and its commit must be on `dev`; otherwise the build fails and publishes nothing.
- **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 three repository secrets: `RELEASE_KEYSTORE_BASE64` (the keystore, base64-encoded), `RELEASE_KEY_ALIAS` and `RELEASE_KEY_PASSWORD`, which is both the store and the key password (keytool's PKCS12 default uses one for both). Only the maintainer holds the key; never commit a keystore. Local release builds are unsigned.
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 9ce2811..daac0ca 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -24,7 +24,7 @@ android {
versionCode = 1
versionName = "0.0.1"
- // The rolling alpha (release.yml, on dev) passes -Ptellyscope.alpha=<run number>:
+ // An alpha tag (release.yml, vX.Y.Z-alpha.N on dev) passes -Ptellyscope.alpha=N:
// a separate app ID, so it installs next to the release.
providers.gradleProperty("tellyscope.alpha").orNull?.let { run ->
applicationIdSuffix = ".alpha"