-1

I have a Github release and I want to download the latest assests with the version tag.

I want to save the .exe file with version include but this will prevent me from downloading the latest release with a single same link every time.

Release details

I want to download the latest released Outdated-Snake.Setup.exe with the tag name (i.e Outdated-Snake.Setup.v2.0.1.exe something like this)

Can I do it with editing the link somehow or do I have to change the .exe file name somehow? What should I do?

flaxel
  • 4,173
  • 4
  • 17
  • 30
OutdatedGuy
  • 160
  • 1
  • 10

1 Answers1

0

You can't do this when you're downloading via the web interface unless you use your browser's Save As functionality.

However, if you're downloading with curl from the command line, you can use the -o option to specify a file name that you'd like to use to save the file. For example, if I wanted to download the latest Git LFS Windows installer to foo.exe, I could do this:

$ curl -L -o foo.exe \
  https://github.com/git-lfs/git-lfs/releases/download/v2.13.3/git-lfs-windows-v2.13.3.exe

You can also write a small shell function to extract the tag from the URL (say, with sed's s command) and then use that to name the file. For example, with the Git LFS file I mentioned above, you could do something like this:

download () {
    url="$1"
    version=$(echo "$1" | sed -e 's!^.*/\(v[0-9]*\.[0-9\]*\.[0-9]*\)/.*$!\1!')
    curl -L -o foo-$version.exe "$url"
}

Since you haven't linked to the repository from which you're trying to download, I can't provide an example that will work with that specific repository, but you can make appropriate adjustments to suit your situation.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • Thanks for the answer but, I am using 'a' tag in html to point that link. [Outdated-Snake-Desktop](https://github.com/OutdatedGuy/Outdated-Snake-Desktop) is the repository. The game where 'a' tag is used is [Outdated-Snake](https://outdated-snake.herokuapp.com) – OutdatedGuy Apr 13 '21 at 14:13
  • Then you're looking for something that your browser can do automatically, which depends on your browser. GitHub doesn't offer a native way to do this any more than any other website does. – bk2204 Apr 13 '21 at 22:27