From d335950c0210909ea5a36339bf9545948a589faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 12 Aug 2022 13:06:21 +0200 Subject: [PATCH] set up the updater script --- .github/workflows/updater.py | 10 +++++++--- .github/workflows/updater.yml | 2 +- manifest.json | 7 +++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/updater.py b/.github/workflows/updater.py index e56c1f9..e2d6d20 100755 --- a/.github/workflows/updater.py +++ b/.github/workflows/updater.py @@ -30,7 +30,10 @@ def get_latest_version(repo: str) -> Tuple[version.Version, Any]: api_url = repo.replace("github.com", "api.github.com/repos") # May use {api_url}/tags and release["name"] for tag-based upstream releases = requests.get(f"{api_url}/releases").json() - release_info = next(release for release in releases if not release["prerelease"]) + release_info = next( + release for release in releases + if not release["prerelease"] + ) return version.Version(release_info["tag_name"]), release_info def get_asset_urls_of_release(repo: str, release: Any) -> List[str]: @@ -64,9 +67,10 @@ def write_src_file(name: str, asset_url: str, extension: str, logging.info("Writing %s...", name) with open(f"conf/{name}", "w", encoding="utf-8") as conf_file: + source_sum = sha256sum_of_url(asset_url) conf_file.write(textwrap.dedent(f"""\ SOURCE_URL={asset_url} - SOURCE_SUM={sha256sum_of_url(asset_url)} + SOURCE_SUM={source_sum} SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT={extension} SOURCE_IN_SUBDIR={str(subdir).lower()} @@ -102,7 +106,7 @@ def main(): return # Proceed only if a PR for this new version does not already exist - branch = f"ci-auto-update-v${latest_version}" + branch = f"ci-auto-update-v{latest_version}" command = ["git", "ls-remote", "--exit-code", "-h", repo, branch] if run(command, stderr=PIPE, stdout=PIPE, check=False).returncode == 0: logging.warning("A branch already exists for this update") diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index f79c97c..e71f2cf 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -13,7 +13,7 @@ on: jobs: updater: # Maintainer should customize the updater script then comment this line. - if: ${{ false }} + # if: ${{ false }} runs-on: ubuntu-latest steps: diff --git a/manifest.json b/manifest.json index 43d73d8..2e823d1 100644 --- a/manifest.json +++ b/manifest.json @@ -30,7 +30,7 @@ "mysql" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -57,7 +57,10 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["fr", "en"], + "choices": [ + "fr", + "en" + ], "default": "fr" }, {