Support for GitLab upstream repos part 2.
This commit is contained in:
parent
2efa7975a8
commit
bb638b1d61
2 changed files with 13 additions and 3 deletions
|
@ -171,7 +171,7 @@ class AppAutoUpdater:
|
|||
|
||||
print(f"\n Checking {source} ...")
|
||||
|
||||
if strategy == "latest_github_release":
|
||||
if strategy == "latest_github_release" or strategy == "latest_gitlab_release":
|
||||
(
|
||||
new_version,
|
||||
new_asset_urls,
|
||||
|
|
|
@ -88,7 +88,9 @@ class GitlabAPI:
|
|||
def releases(self) -> List[str]:
|
||||
"""Get a list of releases for project."""
|
||||
releases = self.internal_api(f"projects/{self.project_id}/releases")
|
||||
return [{
|
||||
retval = []
|
||||
for release in releases:
|
||||
r = {
|
||||
"tag_name": release["tag_name"],
|
||||
"prerelease": False,
|
||||
"draft": False,
|
||||
|
@ -97,7 +99,15 @@ class GitlabAPI:
|
|||
"name": asset["name"],
|
||||
"browser_download_url": asset["direct_asset_url"]
|
||||
} for asset in release["assets"]["links"]],
|
||||
} for release in releases]
|
||||
}
|
||||
for source in release["assets"]["sources"]:
|
||||
r["assets"].append({
|
||||
"name": f"source.{source['format']}",
|
||||
"browser_download_url": source['url']
|
||||
})
|
||||
retval.append(r)
|
||||
|
||||
return retval
|
||||
|
||||
def url_for_ref(self, ref: str, ref_type: RefType) -> str:
|
||||
return f"{self.upstream}/api/v4/projects/{self.project_id}/repository/archive.tar.gz/?sha={ref}"
|
||||
|
|
Loading…
Reference in a new issue