From fd447cc8383a55ebc4a7f288bd04784684ac7d50 Mon Sep 17 00:00:00 2001 From: Julian Lemmerich Date: Tue, 1 Aug 2023 16:10:25 +0200 Subject: [PATCH] ci: enable Magisk Module Updates creates updater.json File in Release --- .github/workflows/main.yml | 2 +- build.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf4ae1a..efb58ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,6 @@ jobs: if: hashFiles('NEW_TAG.txt') != '' uses: ncipollo/release-action@v1.10.0 with: - artifacts: build/*.zip + artifacts: build/*.zip,build/updater.json tag: "${{ env.NEW_TAG }}" body: https://github.com/frida/frida/releases diff --git a/build.py b/build.py index 30e4922..dc7e02f 100644 --- a/build.py +++ b/build.py @@ -7,6 +7,7 @@ import threading import zipfile import concurrent.futures +import json import requests @@ -57,7 +58,8 @@ def create_module_prop(path: Path, project_tag: str): version={project_tag} versionCode={project_tag.replace(".", "").replace("-", "")} author=ViRb3 -description=Run frida-server on boot""" +description=Run frida-server on boot +updateJson=https://github.com/ViRb3/magisk-frida/releases/latest/updater.json""" with open(path.joinpath("module.prop"), "w", newline="\n") as f: f.write(module_prop) @@ -87,6 +89,18 @@ def fill_module(arch: str, frida_tag: str, project_tag: str): extract_file(frida_server_path, files_dir.joinpath(f"frida-server-{arch}")) +def create_updater_json(project_tag: str): + logger.info("Creating updater.json") + + updater ={ + "version": project_tag, + "versionCode": int(project_tag.replace(".", "").replace("-", "")), + "zipUrl": f"https://github.com/ViRb3/magisk-frida/releases/download/{project_tag}/MagiskFrida-{project_tag}.zip" + } + + with open(PATH_BUILD.joinpath("updater.json"), "w", newline="\n") as f: + f.write(json.dumps(updater, indent = 4)) + def package_module(project_tag: str): logger.info("Packaging module") @@ -120,5 +134,6 @@ def do_build(frida_tag: str, project_tag: str): # executor.shutdown() package_module(project_tag) + create_updater_json(project_tag) logger.info("Done")