Download Github build artifact (release) using wget / curl

Purpose: Download github release tar.gz to Docker Build Script so that release files can be used to port dockers. I don’t want the full source code to be downloaded, and I can download it through the archive path using a tag, but rather an assembly artifact that is part of the release.

To be noticeable: This is a download from a private repository, so I'm trying to send my github_token as part of the command now.

Problem: I am having problems downloading github release tar.gz using wget.

wget --header="Authorization: token <GITHUB_TOKEN>" --output-document=<FILENAME>.tar.gz https://github.com/<USER>/<REPO>/releases/download/<TAG>/<FILENAME>.tar.gz 

This returns the following error:

 --2014-12-02 16:19:25-- https://github.com/<USER>/<REPO>/releases/download/<TAG>/<FILENAME>.tar.gz Resolving github.com (github.com)... 192.30.252.131, 192.30.252.131 Connecting to github.com (github.com)|192.30.252.131|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2014-12-02 16:19:25 ERROR 404: Not Found. 

It is worth noting that I am not against using curl to load either or another solution, if necessary.

+5
source share
1 answer

You can use the GitHub API.

To download a release using wget, you can:

 wget --header "Authorization: token <GITHUB TOKEN>" --output-document=<RELEASE>.tar.gz https://api.github.com/repos/<USER>/<REPO>/tarball/<RELEASE NAME> 

Usage can change tarball to zipball to get a zip file.

+4
source

Source: https://habr.com/ru/post/1208169/


All Articles