download-release-action icon indicating copy to clipboard operation
download-release-action copied to clipboard

Select release asset by mask

Open zeegin opened this issue 5 years ago • 2 comments

If we are downloading by latest tag, we cannot know full file name before had download assets release information. Is useful case when some assets contains version number.

zeegin avatar Dec 03 '19 20:12 zeegin

We can implement it using the Regular expressions of jq. Then the first asset machting the given expression will by downloaded for the given tag.

Legion2 avatar Dec 05 '19 12:12 Legion2

I just stumbled upon this while trying to download the latest Linux x64 qsv binary. I came up with the same script:

set -e
set -o pipefail

releases_url='https://api.github.com/repos/jqnatividad/qsv/releases/latest'
assets_url="$(
	curl "$releases_url" -H 'Accept: application/json' -L -s \
	| jq -r '.assets_url'
)"
qsv_x64_url="$(
	curl "$assets_url" -H 'Accept: application/json' -L -s \
	| jq -r '.[] | select(.name | test("qsv-[0-9.]+-x86_64-unknown-linux-gnu.zip")) | .browser_download_url'
)"

derhuerst avatar Jan 02 '22 16:01 derhuerst