.md.
A copy of the phone app's tool/compose_release_notes.py (sozo repository),
-adapted to one APK and the TV's paths.
+adapted to the TV apps (Android TV APK, Apple TV IPA, LG webOS IPK) and the
+TV repository's paths.
Images may be written relative to the notes file. They become links to the
exact commit being released, so they work in a draft before anything reaches
@@ -30,7 +31,7 @@
import sys
from pathlib import Path
-from release_banner import banner_text, kind_of
+from release_banner import PLATFORMS, banner_text, kind_of, platform_list
IMAGE_BLOCK = re.compile(r']*>\s*(
]*>)\s*
\n?', re.I)
@@ -78,13 +79,22 @@ def markdown(match):
return MD_IMG.sub(markdown, HTML_IMG.sub(html, text))
+# (file extension, device column, platform key), in the order of the table.
+KINDS = [
+ (".apk", "📺 Android TV, Google TV, Shield, TV boxes", "androidtv"),
+ (".ipa", "🍎 Apple TV (tvOS 17+), unsigned: sideload it", "appletv"),
+ (".ipk", "🟣 LG TV, webOS 4 and newer (Developer Mode)", "webos"),
+]
+
+
def downloads_table(assets, repo, tag, version):
names = sorted(p.name for p in assets.iterdir()) if assets.is_dir() else []
rows = []
- for name in names:
- if name.startswith(f"sozo-tv-{version}-") and name.endswith(".apk"):
- url = f"https://github.com/{repo}/releases/download/{tag}/{name}"
- rows.append(f"| 📺 Android TV, Google TV, Shield, TV boxes | [`{name}`]({url}) |")
+ for ext, device, _ in KINDS:
+ for name in names:
+ if name.startswith(f"sozo-tv-{version}-") and name.endswith(ext):
+ url = f"https://github.com/{repo}/releases/download/{tag}/{name}"
+ rows.append(f"| {device} | [`{name}`]({url}) |")
if not rows:
return "The files are attached to this release."
lines = ["| Device | File |", "|---|---|", *rows]
@@ -169,10 +179,70 @@ def compose(version, sha, repo, tag, assets, repo_root, warn):
return text.replace("", downloads_table(assets, repo, tag, version))
-def generate(version, sha, repo, tag, previous, assets, repo_root, log_lines, intro=""):
+INSTALL = {
+ "androidtv": [
+ "",
+ "📺 How to install it on an Android TV
",
+ "",
+ "- **Updating:** if Sozo TV is already installed, it offers this version itself.",
+ "- **With Downloader:** install *Downloader* from the TV's app store, allow it to install",
+ " apps, and open the APK link above in it.",
+ "- **With a USB stick:** copy the APK onto it and open it with the TV's file manager.",
+ "",
+ "If the TV says the app is not installed, an older Sozo TV signed with a different key",
+ "is on it: uninstall that one first.",
+ " ",
+ ],
+ "appletv": [
+ "",
+ "🍎 How to install it on an Apple TV
",
+ "",
+ "Sozo is not on the App Store, and this IPA is not signed. A sideloading tool signs it",
+ "with your own Apple ID while it installs:",
+ "",
+ "- **Sideloadly** (Windows/macOS): pair the Apple TV over Wi-Fi, drop the IPA in, sign in",
+ " with your Apple ID and press Start.",
+ "- **Xcode** (macOS): Window → Devices and Simulators, pair the Apple TV, then install the",
+ " IPA after signing it with your team.",
+ "",
+ "With a free Apple ID the app stops opening after 7 days and has to be installed again;",
+ "a paid developer account makes that a year.",
+ " ",
+ ],
+ "webos": [
+ "",
+ "🟣 How to install it on an LG TV (webOS)
",
+ "",
+ "1. On the TV, install **Developer Mode** from the LG Content Store, sign in with a free",
+ " LG Developer account, turn on **Dev Mode Status** and let the TV restart.",
+ "2. In Developer Mode, turn on **Key Server**.",
+ "3. On a computer with Node.js on the same network:",
+ "",
+ " ```sh",
+ " npx @webos-tools/cli ares-setup-device # name tv, the TV's IP, port 9922, user prisoner",
+ " npx @webos-tools/cli ares-novacom --device tv --getkey",
+ " npx @webos-tools/cli ares-install --device tv sozo-tv--webos.ipk",
+ " ```",
+ "",
+ "Developer Mode runs out unless **EXTEND** is pressed in time; the app is removed with it.",
+ "On a rooted TV, install the IPK with Homebrew Channel or webOS Dev Manager instead.",
+ " ",
+ ],
+}
+
+
+def shipped(assets, version):
+ """Platform keys whose file is among the assets, in table order."""
+ names = [p.name for p in assets.iterdir()] if assets.is_dir() else []
+ return [key for ext, _, key in KINDS
+ if any(n.startswith(f"sozo-tv-{version}-") and n.endswith(ext) for n in names)]
+
+
+def generate(version, sha, repo, tag, previous, assets, repo_root, log_lines, intro="", platforms=None):
"""A page in the layout of the phone app's v3.2.0 notes, for a version nobody wrote up."""
items = changes(log_lines)
- t = banner_text(version, "", areas(items))
+ platforms = platforms or shipped(assets, version) or ["androidtv"]
+ t = banner_text(version, "", areas(items), platforms=platforms)
patch = kind_of(version) == "PATCH RELEASE"
lines = [
'',
@@ -203,18 +273,10 @@ def generate(version, sha, repo, tag, previous, assets, repo_root, log_lines, in
lines += [
"---", "", "## ⬇ Download", "",
downloads_table(assets, repo, tag, version), "",
- "",
- "📺 How to install it on a TV
",
- "",
- "- **Updating:** if Sozo TV is already installed, it offers this version itself.",
- "- **With Downloader:** install *Downloader* from the TV's app store, allow it to install",
- " apps, and open the APK link above in it.",
- "- **With a USB stick:** copy the APK onto it and open it with the TV's file manager.",
- "",
- "If the TV says the app is not installed, an older Sozo TV signed with a different key",
- "is on it: uninstall that one first.",
- " ",
- "",
+ ]
+ for key in platforms:
+ lines += [l.replace("", version) for l in INSTALL[key]] + [""]
+ lines += [
"---", "", "## 💬 Join the community", "",
f"- 📣 **Telegram**: [@sozoapp](https://telegram.me/sozoapp) for new versions and announcements first.",
"- 🎧 **Discord**: [discord.gg/n22URhYvMR](https://discord.gg/n22URhYvMR) to suggest ideas and report bugs.",
@@ -255,15 +317,18 @@ def shorten(md, limit=230):
return md
-def telegram_caption(version, notes_text, log_lines, intro=""):
- t = banner_text(version, notes_text, areas(changes(log_lines)))
+def telegram_caption(version, notes_text, log_lines, intro="", platforms=("androidtv",)):
+ t = banner_text(version, notes_text, areas(changes(log_lines)), platforms=platforms)
kind = "yamoq (patch)" if kind_of(version) == "PATCH RELEASE" else "yangi versiya"
head = [f"📺 Sozo TV v{html.escape(version)} · {kind}",
f"{html.escape(t['line1'])} {html.escape(t['line2'])}"]
+ if len(platforms) > 1:
+ head.append("🖥 " + " · ".join(PLATFORMS[p] for p in platforms))
if intro.strip():
head += ["", f"📝 {html.escape(intro.strip())}"]
head += ["", "✨ Nima yangi"]
- tail = ["", "⬇️ APK shu xabar ostida · 📣 @sozoapp"]
+ files = "APK" if list(platforms) == ["androidtv"] else "Fayllar"
+ tail = ["", f"⬇️ {files} shu xabar ostida · 📣 @sozoapp"]
bullets = []
uz = UZ_SUMMARY.search(notes_text or "")
@@ -299,6 +364,7 @@ def main():
parser.add_argument("--intro", default="", help="text from the release form, put on top")
parser.add_argument("--auto", action="store_true", help="generate a page when there are no notes")
parser.add_argument("--root", default=".")
+ parser.add_argument("--platforms", default="", help="androidtv,appletv,webos (default: from --assets)")
args = parser.parse_args()
root = Path(args.root).resolve()
log_lines = read_log(args.log)
@@ -307,7 +373,8 @@ def main():
notes = notes_path(root, args.version)
text = notes.read_text(encoding="utf-8") if notes.is_file() else ""
Path(args.telegram).write_text(
- telegram_caption(args.version, text, log_lines, args.intro), encoding="utf-8")
+ telegram_caption(args.version, text, log_lines, args.intro,
+ platform_list(args.platforms)), encoding="utf-8")
if not args.out:
return 0
@@ -315,7 +382,8 @@ def main():
body = compose(args.version, args.sha, args.repo, args.tag, Path(args.assets), root, warn)
if body is None and args.auto:
body = generate(args.version, args.sha, args.repo, args.tag, args.previous,
- Path(args.assets), root, log_lines, args.intro)
+ Path(args.assets), root, log_lines, args.intro,
+ platform_list(args.platforms) if args.platforms else None)
if body is None:
print(f"No release/notes/v{args.version}.md")
return 3
diff --git a/tools/release/release_page_test.py b/tools/release/release_page_test.py
index a5185b0e..9b5c3748 100644
--- a/tools/release/release_page_test.py
+++ b/tools/release/release_page_test.py
@@ -50,11 +50,26 @@ def test_generated_page(self):
out = generate("1.0.4", SHA, REPO, "v1.0.4", "1.0.2", self.assets, self.root, LOG, "Hotfix.")
for part in ("Sozo TV v1.0.4 is a patch release", "Hotfix.", "### ▶️ Player",
"[#40](https://github.com/o/r/pull/40)", "sozo-tv-1.0.4-4.apk",
- "How to install it on a TV", "compare/1.0.2...v1.0.4", "sozo-tv?style"):
+ "How to install it on an Android TV", "compare/1.0.2...v1.0.4", "sozo-tv?style"):
self.assertIn(part, out)
self.assertNotIn("macOS", out)
+ self.assertNotIn("Apple TV", out)
self.assertNotIn("a banner and a Telegram post", out)
+ def test_all_three_tvs(self):
+ for name in ("sozo-tv-1.0.4-webos.ipk", "sozo-tv-1.0.4-appletv.ipa"):
+ (self.assets / name).write_bytes(b"x")
+ out = generate("1.0.4", SHA, REPO, "v1.0.4", "", self.assets, self.root, LOG)
+ apk, ipa, ipk = (out.index(f"sozo-tv-1.0.4-{n}") for n in ("4.apk", "appletv.ipa", "webos.ipk"))
+ self.assertLess(apk, ipa)
+ self.assertLess(ipa, ipk)
+ for part in ("install it on an Android TV", "install it on an Apple TV",
+ "install it on an LG TV", "ares-install --device tv sozo-tv-1.0.4-webos.ipk"):
+ self.assertIn(part, out)
+ cap = telegram_caption("1.0.4", "", LOG, platforms=["androidtv", "appletv", "webos"])
+ self.assertIn("🖥 Android TV · Apple TV · LG webOS", cap)
+ self.assertIn("⬇️ Fayllar shu xabar ostida", cap)
+
def test_caption(self):
out = telegram_caption("1.0.4", "", LOG, "Bugun")
self.assertTrue(out.startswith("📺 Sozo TV v1.0.4 · yamoq (patch)"))
@@ -75,6 +90,9 @@ def test_tv_words(self):
self.assertEqual(t["line2"], "on the big screen.")
self.assertEqual(t["chips"], ["Android TV", "Google TV · Shield"])
self.assertEqual(banner_text("2.0.0", "", ["Player"])["line1"], "Everything new in Sozo TV 2.0.0,")
+ all3 = banner_text("1.0.4", "", ["Player"], dt.date(2026, 11, 14), ["androidtv", "appletv", "webos"])
+ self.assertEqual(all3["eyebrow"], "SMART TV · NOVEMBER 2026")
+ self.assertEqual(all3["chips"], ["Android TV", "Apple TV", "LG webOS", "Player"])
def test_render(self):
template = TEMPLATE.read_text(encoding="utf-8")
diff --git a/tools/release/stamp_version.py b/tools/release/stamp_version.py
index c284b3ef..f9c74c9f 100644
--- a/tools/release/stamp_version.py
+++ b/tools/release/stamp_version.py
@@ -1,22 +1,42 @@
#!/usr/bin/env python3
-"""Writes versionName and versionCode into app/build.gradle.kts.
+"""Writes one release version into all three TV apps.
python3 tools/release/stamp_version.py 1.0.4 4
+
+Android TV: versionName/versionCode in app/build.gradle.kts.
+Apple TV: MARKETING_VERSION/CURRENT_PROJECT_VERSION in apple-tv/project.yml.
+LG webOS: "version" in webos/appinfo.json and VERSION in webos/js/app.js.
+ webOS only takes x.y.z; any other name leaves it as it is.
"""
import re
import sys
+from pathlib import Path
+
-PATH = 'app/build.gradle.kts'
+def sub_once(path, pattern, repl):
+ p = Path(path)
+ src = p.read_text(encoding='utf-8')
+ out, n = re.subn(pattern, repl, src, count=1, flags=re.M)
+ if n != 1:
+ sys.exit(f'{path}: expected one match for {pattern}')
+ p.write_text(out, encoding='utf-8')
def main() -> None:
name, code = sys.argv[1], sys.argv[2]
- src = open(PATH, encoding='utf-8').read()
- src, n1 = re.subn(r'(?m)^(\s*versionCode\s*=\s*)\d+', rf'\g<1>{code}', src, count=1)
- src, n2 = re.subn(r'(?m)^(\s*versionName\s*=\s*)"[^"]*"', rf'\g<1>"{name}"', src, count=1)
- if n1 != 1 or n2 != 1:
- sys.exit(f'expected one versionCode and one versionName, replaced {n1}/{n2}')
- open(PATH, 'w', encoding='utf-8').write(src)
+ sub_once('app/build.gradle.kts', r'^(\s*versionCode\s*=\s*)\d+', rf'\g<1>{code}')
+ sub_once('app/build.gradle.kts', r'^(\s*versionName\s*=\s*)"[^"]*"', rf'\g<1>"{name}"')
+
+ if Path('apple-tv/project.yml').is_file():
+ sub_once('apple-tv/project.yml', r'^(\s*MARKETING_VERSION:\s*)"[^"]*"', rf'\g<1>"{name}"')
+ sub_once('apple-tv/project.yml', r'^(\s*CURRENT_PROJECT_VERSION:\s*)"[^"]*"', rf'\g<1>"{code}"')
+
+ if Path('webos/appinfo.json').is_file():
+ if re.fullmatch(r'\d+\.\d+\.\d+', name):
+ sub_once('webos/appinfo.json', r'^(\s*"version"\s*:\s*)"[^"]*"', rf'\g<1>"{name}"')
+ sub_once('webos/js/app.js', r"^(\s*var VERSION = )'[^']*'", rf"\g<1>'{name}'")
+ else:
+ print(f'::warning::webOS takes only x.y.z; {name} not written to webos/')
if __name__ == '__main__':
diff --git a/webos/README.md b/webos/README.md
index ae93387a..cdb5c3be 100644
--- a/webos/README.md
+++ b/webos/README.md
@@ -36,7 +36,10 @@ allowed, because `service/` is held to ES5 by the tests.
`hls.min.js`, so the ES5 checks would no longer describe what ships.
The `webOS CI` workflow also builds the ipk and keeps it as the `sozo-webos-ipk` artifact for 14 days.
-The `webOS release` workflow, run by hand, publishes it as a `webos-v` GitHub pre-release. The version comes from `appinfo.json`.
+The TV release workflow (`.github/workflows/release.yml`, Actions → Release → Telegram) builds this ipk
+together with the Android TV APK and the Apple TV IPA, gives all three the same version (it writes it into
+`appinfo.json` and `js/app.js`), and attaches the ipk to the same GitHub Release as
+`sozo-tv--webos.ipk`.
## Install with Developer Mode
diff --git a/webos/test/compat.test.js b/webos/test/compat.test.js
index 732d822b..420220ff 100644
--- a/webos/test/compat.test.js
+++ b/webos/test/compat.test.js
@@ -96,7 +96,8 @@ test('css stays inside the Chromium 53 baseline', () => {
test('appinfo.json holds the agreed manifest', () => {
const a = JSON.parse(read('appinfo.json'));
assert.equal(a.id, 'com.soplay.sozo.webos');
- assert.equal(a.version, '1.0.0');
+ assert.match(a.version, /^\d+\.\d+\.\d+$/);
+ assert.match(read('js/app.js'), new RegExp("var VERSION = '" + a.version.replace(/\./g, '\\.') + "'"));
assert.equal(a.type, 'web');
assert.equal(a.main, 'index.html');
assert.equal(a.resolution, '1920x1080');
From c15c28ef626786455856793840006501270886fd Mon Sep 17 00:00:00 2001
From: professorDeveloper
<108933534+professorDeveloper@users.noreply.github.com>
Date: Sat, 14 Nov 2026 19:49:18 +0500
Subject: [PATCH 2/2] Mirror every published release to Sozo-app/sozo-tv
mirror-release.yml copies the tag (made through the API at the same commit),
title, notes and files of a published release to the organization's copy.
It runs on Publish, by hand, and from release.yml when that publishes itself.
---
.github/workflows/mirror-release.yml | 126 +++++++++++++++++++++++++++
.github/workflows/release.yml | 8 +-
2 files changed, 133 insertions(+), 1 deletion(-)
create mode 100644 .github/workflows/mirror-release.yml
diff --git a/.github/workflows/mirror-release.yml b/.github/workflows/mirror-release.yml
new file mode 100644
index 00000000..250bb797
--- /dev/null
+++ b/.github/workflows/mirror-release.yml
@@ -0,0 +1,126 @@
+name: Mirror release → Sozo-app
+run-name: Mirror ${{ inputs.tag || github.event.release.tag_name }} to Sozo-app
+
+# Copies a published release of this repository to the Sozo-app organization's
+# copy of it (Sozo-app/): the tag at the same commit, the title,
+# the notes and every file.
+#
+# Runs when a release is published here, and by hand (Actions → this workflow)
+# for a release that changed afterwards, e.g. files added by a later run.
+# release.yml starts it too when it publishes or adds files itself, because
+# what GITHUB_TOKEN does starts no workflow.
+#
+# The organization's repositories are forks whose branches went their own way,
+# so no branch is touched. The tag is made through the API: forks see the
+# commits of this repository, so nothing has to be pushed. The copy is built as
+# a draft and published once its files are attached, which also keeps the
+# fork's own `push: tags` release workflow from building anything (its gate
+# skips a tag that already has a release).
+#
+# Secret: SOZO_APP_TOKEN, a token that can write the organization's repository
+# (fine-grained: resource owner Sozo-app, Contents read and write).
+# Optional variable: MIRROR_REPO, owner/name of the copy if it is not
+# Sozo-app/.
+
+on:
+ release:
+ types: [published]
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Tag of a published release in this repository, e.g. v3.2.1'
+ required: true
+ type: string
+
+permissions:
+ contents: read
+
+concurrency:
+ group: mirror-release-${{ inputs.tag || github.event.release.tag_name }}
+ cancel-in-progress: false
+
+jobs:
+ mirror:
+ # The organization's fork carries this file too; it must not copy itself.
+ if: github.repository_owner == 'professorDeveloper'
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ steps:
+ - name: Copy the release
+ env:
+ TAG: ${{ inputs.tag || github.event.release.tag_name }}
+ SRC: ${{ github.repository }}
+ DEST: ${{ vars.MIRROR_REPO || format('Sozo-app/{0}', github.event.repository.name) }}
+ SRC_TOKEN: ${{ github.token }}
+ DEST_TOKEN: ${{ secrets.SOZO_APP_TOKEN }}
+ run: |
+ set -euo pipefail
+ if [ -z "${DEST_TOKEN}" ]; then
+ echo "::error title=No SOZO_APP_TOKEN::Add a token that can write ${DEST} as the SOZO_APP_TOKEN secret of ${SRC}."
+ exit 1
+ fi
+ src() { GH_TOKEN="${SRC_TOKEN}" gh "$@"; }
+ dest() { GH_TOKEN="${DEST_TOKEN}" gh "$@"; }
+
+ # /releases/tags/ answers only for a published release.
+ if ! src api "repos/${SRC}/releases/tags/${TAG}" > rel.json; then
+ echo "::error title=No published release::${SRC} has no published release ${TAG}."
+ exit 1
+ fi
+ SHA="$(src api "repos/${SRC}/commits/${TAG}" --jq .sha)"
+ LATEST="$(src api "repos/${SRC}/releases/latest" --jq .tag_name 2>/dev/null || true)"
+ MAKE_LATEST=false
+ if [ "${LATEST}" = "${TAG}" ]; then MAKE_LATEST=true; fi
+ echo "${SRC} ${TAG} at ${SHA} → ${DEST} (latest: ${MAKE_LATEST})"
+
+ # The tag the copy already has must be this commit; an existing one
+ # that is not is somebody else's, and is left for a person to sort out.
+ if dest api "repos/${DEST}/git/ref/tags/${TAG}" > ref.json 2>/dev/null; then
+ HAVE="$(jq -r .object.sha ref.json)"
+ if [ "$(jq -r .object.type ref.json)" = tag ]; then
+ HAVE="$(dest api "repos/${DEST}/git/tags/${HAVE}" --jq .object.sha)"
+ fi
+ if [ "${HAVE}" != "${SHA}" ]; then
+ echo "::error title=Tag differs::${DEST} already has ${TAG} at ${HAVE}, not ${SHA}. Delete it there and run this again."
+ exit 1
+ fi
+ fi
+
+ # Links to this release's files point at the copy's files instead.
+ jq --arg src "github.com/${SRC}/releases/download/" \
+ --arg dest "github.com/${DEST}/releases/download/" \
+ --arg sha "${SHA}" '{
+ tag_name: .tag_name, target_commitish: $sha, name: .name,
+ body: ((.body // "") | split($src) | join($dest)),
+ prerelease: .prerelease }' rel.json > fields.json
+
+ # Includes drafts, which /releases/tags/ does not see.
+ ID="$(dest api --paginate "repos/${DEST}/releases" \
+ --jq ".[] | select(.tag_name == \"${TAG}\") | .id" | head -1)"
+ if [ -n "${ID}" ]; then
+ dest api -X PATCH "repos/${DEST}/releases/${ID}" --input fields.json > /dev/null
+ echo "Updating the existing release ${ID}"
+ else
+ jq '. + {draft: true}' fields.json > create.json
+ ID="$(dest api -X POST "repos/${DEST}/releases" --input create.json --jq .id)"
+ echo "Created draft ${ID}"
+ fi
+
+ mkdir -p assets
+ src release download "${TAG}" -R "${SRC}" -D assets
+ shopt -s nullglob
+ FILES=(assets/*)
+ if [ "${#FILES[@]}" -gt 0 ]; then
+ ls -lh assets
+ dest release upload "${TAG}" -R "${DEST}" "${FILES[@]}" --clobber
+ fi
+
+ dest api -X PATCH "repos/${DEST}/releases/${ID}" -F draft=false \
+ -f make_latest="${MAKE_LATEST}" --jq .html_url > url.txt
+ echo "::notice title=Mirrored::$(cat url.txt)"
+ {
+ echo "### ${TAG} → ${DEST}"
+ echo ""
+ echo "- $(cat url.txt)"
+ echo "- ${#FILES[@]} files, commit \`${SHA}\`"
+ } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index aa0f1c4f..f5b73a74 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -491,6 +491,7 @@ jobs:
timeout-minutes: 15
permissions:
contents: write
+ actions: write # starts mirror-release.yml
outputs:
sha: ${{ steps.tag.outputs.sha }}
release: ${{ steps.release.outputs.status }}
@@ -617,10 +618,15 @@ jobs:
fi
gh release create "${TAG}" "${FILES[@]}" "${ARGS[@]}"
fi
- if [ "${MODE}" = draft ]; then
+ if [ "$(gh release view "${TAG}" --json isDraft --jq .isDraft)" = true ]; then
echo "status=draft" >> "$GITHUB_OUTPUT"
else
echo "status=published" >> "$GITHUB_OUTPUT"
+ # What GITHUB_TOKEN publishes starts no workflow, so the copy for
+ # the Sozo-app organization is started by hand. A draft is copied
+ # when somebody presses Publish.
+ gh workflow run mirror-release.yml --ref "${GITHUB_REF_NAME}" -f tag="${TAG}" \
+ || echo "::warning title=Not mirrored::Run 'Mirror release → Sozo-app' for ${TAG} by hand."
fi
publish: