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 an alpha only for [release] PRs into dev

jesse-agent-362c8c78d0af213
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9b99e10..aede298 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -14,11 +14,38 @@ concurrency:
cancel-in-progress: false
jobs:
- # Alpha: every push to dev publishes the next v<versionName>-alpha.N as a
- # pre-release; pushing such a tag on a dev commit by hand does the same for
- # that tag. app.tellyscope.alpha installs next to the release build.
+ # A push to dev publishes an alpha only when it came from a PR into dev whose
+ # title contains [release]; anything else ends here, green. No secrets in this
+ # job, and the title only ever reaches jq, never a shell.
+ alpha-gate:
+ if: github.ref == 'refs/heads/dev'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pull-requests: read
+ outputs:
+ publish: ${{ steps.marker.outputs.publish }}
+ steps:
+ - name: "[release] in the PR title"
+ id: marker
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ PUBLISH=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" --jq \
+ 'any(.[]; .base.ref == "dev" and .merged_at != null and (.title | ascii_downcase | contains("[release]")))')
+ if [ "$PUBLISH" != true ]; then
+ echo "::notice::No merged PR into dev with [release] in its title for ${GITHUB_SHA::7}; no alpha this time"
+ PUBLISH=false
+ fi
+ echo "publish=$PUBLISH" >> "$GITHUB_OUTPUT"
+
+ # Alpha: publishes the next v<versionName>-alpha.N as a pre-release for a
+ # [release] merge into dev; pushing such a tag on a dev commit by hand does the
+ # same for that tag. app.tellyscope.alpha installs next to the release build.
alpha:
- if: github.ref_type == 'tag' || github.ref == 'refs/heads/dev'
+ needs: alpha-gate
+ # always(): a tag push skips the gate, and a skipped need would skip this job too.
+ if: always() && (github.ref_type == 'tag' || needs.alpha-gate.outputs.publish == 'true')
runs-on: ubuntu-latest
# Its own key, in its own Environment: an alpha can never update a prod install, and a dev
# push never sees the prod key.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 35d1d1f..5af162a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,7 +13,7 @@ Thanks for helping! Tellyscope is in alpha, so the code and its structure are st
## Releases
-- **Alpha:** every merge into `dev` publishes an alpha. CI builds `app.tellyscope.alpha`, which installs next to the release, and once the build passes it tags the commit `vX.Y.Z-alpha.N` and publishes a GitHub pre-release under that tag, with the APK named `Tellyscope-vX.Y.Z-alpha.N.apk`. `X.Y.Z` is the current `versionName`, and `N` is one past the highest alpha of that version. A failed build tags nothing. You can still put out an alpha by hand: tag a commit that is on `dev` and push the tag, for example `git tag v0.1.0-alpha.1 origin/dev && git push origin v0.1.0-alpha.1`. 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.
+- **Alpha:** to publish an alpha, put `[release]` anywhere in the title of the pull request into `dev` (any case), for example `Fix the remote [release]`. Merges without it only run CI. On a `[release]` merge, CI builds `app.tellyscope.alpha`, which installs next to the release, and once the build passes it tags the commit `vX.Y.Z-alpha.N` and publishes a GitHub pre-release under that tag, with the APK named `Tellyscope-vX.Y.Z-alpha.N.apk`. `X.Y.Z` is the current `versionName`, and `N` is one past the highest alpha of that version. A failed build tags nothing. You can still put out an alpha by hand: tag a commit that is on `dev` and push the tag, for example `git tag v0.1.0-alpha.1 origin/dev && git push origin v0.1.0-alpha.1`. 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 turn the `## Unreleased` section of [CHANGELOG.md](CHANGELOG.md) into that version's section; 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:** alphas and releases are signed with two different keys, so an alpha can never install over the release app. Each key lives in its own GitHub Environment: `ALPHA_KEYSTORE_BASE64`, `ALPHA_KEY_ALIAS` and `ALPHA_KEY_PASSWORD` in `alpha`, which deploys only from `dev` and `v*-alpha.*` tags; `RELEASE_KEYSTORE_BASE64`, `RELEASE_KEY_ALIAS` and `RELEASE_KEY_PASSWORD` in `release`, which deploys only from `main`. `*_KEYSTORE_BASE64` is the keystore, base64-encoded, and `*_KEY_PASSWORD` is both the store and the key password (keytool's PKCS12 default uses one for both). A job with its secrets missing fails; it never falls back to the other key. Only the maintainer holds the keys; never commit a keystore. Local release builds are unsigned.