2

Sorry for asking what is probably a noob question.

I'm new to the GitHub and DevOps environments, and I've been tasked with automating some stuff. I've found a project on GitHub that is still maintained, and in the future will receive new releases.

I would like to build a pipeline in which I will need to download from GitHub the latest exe version for my specific environment.

At the moment, they have the release packages in their git repo, under /releases/vX.y.z (where X, y and z are release versions) with several packages, named like:

etc.

Considering the fact that the versions will change in time, is there any way I could wget a specific package by using some sort of pattern?

Happily the link: https://github.com/some-example-repo/releases/latest redirects towards the latest version released and so I was thinking of something like:

wget https://github.com/some-example-repo/download/*????/package.V???*-linux-arm64.tar.gz

Thinking about it, now that I've put this down as a question, I think it would be impossible for wget to auto-complete the URL...

1

1 Answer 1

18

If you really want to always download the latest release, you should use the GitHub API for this:

curl https://api.github.com/repos/$USER/$REPO/releases/latest

This will return a JSON document describing the latest release, including all artifacts; you can filter the result with jq, e.g.

| jq -r '.assets[].browser_download_url'

to extract all the asset download URLs.

In practice however it’s often a bad idea to always download the latest release, because any breaking change could break your CI. You should instead download a specific release and upgrade as appropriate manually (perhaps with automation to test new releases and suggest the corresponding PR).

3
  • 1
    "because any breaking change could break your CI" - that and it will also be difficult to find out what environment specific builds/tests happened in (one will need to cross-reference build times with release schedules) leading to difficult to diagnose "works on my machine" bugs.
    – user9123
    Aug 29, 2022 at 22:52
  • @user9123 I would expect the CI logs to keep a trace of what was downloaded, but if they don’t then yes, it could be complicated to determine what version was used after the fact. Aug 30, 2022 at 5:48
  • Thanks @iBug, I can’t believe I got that wrong! I had the command in my terminal… Aug 30, 2022 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .