Closed AAGaming00 closed 9 months ago
This occurred to me while I was working on the beta stuff too - I think it should be possible with either the Github API or the ghcr.io
registry API. A quick test shows we should be able to extract the build ID from the tags like this (API call would look a little different for an organization but same idea: https://docs.github.com/en/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization)
$ gh api /user/packages/container/holo-base/versions | jq '.[] | select(.metadata.container.tags | contains(["latest"]))'
{
"id": 129951019,
"name": "sha256:e62862f9f5bf70d9136bb35f623f3e1ead6d6c436eb82da04c310c585369d58c",
"url": "https://api.github.com/users/ian-h-chamberlain/packages/container/holo-base/versions/129951019",
"package_html_url": "https://github.com/users/ian-h-chamberlain/packages/container/package/holo-base",
"created_at": "2023-09-21T02:52:08Z",
"updated_at": "2023-09-21T02:52:08Z",
"html_url": "https://github.com/users/ian-h-chamberlain/packages/container/holo-base/129951019",
"metadata": {
"package_type": "container",
"container": {
"tags": [
"build-20230831.1",
"3.4",
"latest",
"3.4.10"
]
}
}
}
There is also a more standard container registry API at https://ghcr.io/v2/
which I think can be queried using GITHUB_TOKEN
, but I've had trouble figuring out how to authenticate to it for testing. Either way should work I think, since really all we need is to grab the tag for latest
, or beta
, or whatever and extract the build ID.
Much easier for us to make sure broken updates don't occur with manual.
perhaps using GitHub actions cron stuff - but where would we store the previous version id?