mirror of
https://github.com/YunoHost-Apps/pytition_ynh.git
synced 2024-09-03 20:16:08 +02:00
set up the updater script
This commit is contained in:
parent
c135e992c8
commit
192955cc85
3 changed files with 12 additions and 5 deletions
10
.github/workflows/updater.py
vendored
10
.github/workflows/updater.py
vendored
|
@ -30,7 +30,10 @@ def get_latest_version(repo: str) -> Tuple[version.Version, Any]:
|
||||||
api_url = repo.replace("github.com", "api.github.com/repos")
|
api_url = repo.replace("github.com", "api.github.com/repos")
|
||||||
# May use {api_url}/tags and release["name"] for tag-based upstream
|
# May use {api_url}/tags and release["name"] for tag-based upstream
|
||||||
releases = requests.get(f"{api_url}/releases").json()
|
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
|
return version.Version(release_info["tag_name"]), release_info
|
||||||
|
|
||||||
def get_asset_urls_of_release(repo: str, release: Any) -> List[str]:
|
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)
|
logging.info("Writing %s...", name)
|
||||||
|
|
||||||
with open(f"conf/{name}", "w", encoding="utf-8") as conf_file:
|
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"""\
|
conf_file.write(textwrap.dedent(f"""\
|
||||||
SOURCE_URL={asset_url}
|
SOURCE_URL={asset_url}
|
||||||
SOURCE_SUM={sha256sum_of_url(asset_url)}
|
SOURCE_SUM={source_sum}
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT={extension}
|
SOURCE_FORMAT={extension}
|
||||||
SOURCE_IN_SUBDIR={str(subdir).lower()}
|
SOURCE_IN_SUBDIR={str(subdir).lower()}
|
||||||
|
@ -102,7 +106,7 @@ def main():
|
||||||
return
|
return
|
||||||
|
|
||||||
# Proceed only if a PR for this new version does not already exist
|
# 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]
|
command = ["git", "ls-remote", "--exit-code", "-h", repo, branch]
|
||||||
if run(command, stderr=PIPE, stdout=PIPE, check=False).returncode == 0:
|
if run(command, stderr=PIPE, stdout=PIPE, check=False).returncode == 0:
|
||||||
logging.warning("A branch already exists for this update")
|
logging.warning("A branch already exists for this update")
|
||||||
|
|
2
.github/workflows/updater.yml
vendored
2
.github/workflows/updater.yml
vendored
|
@ -13,7 +13,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
updater:
|
updater:
|
||||||
# Maintainer should customize the updater script then comment this line.
|
# Maintainer should customize the updater script then comment this line.
|
||||||
if: ${{ false }}
|
# if: ${{ false }}
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -56,7 +56,10 @@
|
||||||
"en": "Choose the application language",
|
"en": "Choose the application language",
|
||||||
"fr": "Choisissez la langue de l'application"
|
"fr": "Choisissez la langue de l'application"
|
||||||
},
|
},
|
||||||
"choices": ["fr", "en"],
|
"choices": [
|
||||||
|
"fr",
|
||||||
|
"en"
|
||||||
|
],
|
||||||
"default": "fr"
|
"default": "fr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue