Skip to content

Commit

Permalink
Allow prereleases in autoupdater. Mainly to support Vikunja.
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar authored and OniriCorpe committed Apr 2, 2024
1 parent ffb3555 commit 58fef77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion schemas/manifest.v2.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@
},
"force_version": {
"type": "string"
},
"allow_prereleases": {
"type": "boolean",
"description": "Allow prereleases when using strategy = latest_X_release"
}
}
}
Expand Down Expand Up @@ -633,4 +637,4 @@
"resources"
],
"additionalProperties": false
}
}
9 changes: 8 additions & 1 deletion tools/autoupdate_app_sources/autoupdate_app_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ def get_latest_version_and_asset(
) -> Optional[tuple[str, Union[str, dict[str, str]], str]]:
upstream = autoupdate.get("upstream", self.main_upstream).strip("/")
version_re = autoupdate.get("version_regex", None)
allow_prereleases = autoupdate.get("allow_prereleases", False)
_, remote_type, revision_type = strategy.split("_")

api: Union[GithubAPI, GitlabAPI, GiteaForgejoAPI]
Expand All @@ -464,8 +465,14 @@ def get_latest_version_and_asset(
releases: dict[str, dict[str, Any]] = {
release["tag_name"]: release
for release in api.releases()
if not release["draft"] and not release["prerelease"]
}

if not allow_prereleases:
releases = {
name: info for name, info in releases.items()
if not info["draft"] and not info["prerelease"]
}

latest_version_orig, latest_version = self.relevant_versions(
list(releases.keys()), self.app_id, version_re
)
Expand Down

0 comments on commit 58fef77

Please sign in to comment.