SteamDeckHomebrew / holo-docker

Docker images of the SteamOS Holo system
GNU General Public License v3.0
30 stars 10 forks source link

auto updates #7

Closed AAGaming00 closed 9 months ago

AAGaming00 commented 1 year ago

perhaps using GitHub actions cron stuff - but where would we store the previous version id?

ian-h-chamberlain commented 1 year 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.

TrainDoctor commented 9 months ago

Much easier for us to make sure broken updates don't occur with manual.