cli/script/scoop-gen
Mislav Marohnić 0a17259e3c Bump scoop bucket manually on release
Goreleaser can no longer do this for us since we're always creating a
draft release initially.
2020-10-01 19:09:14 +02:00

30 lines
762 B
Bash
Executable file

#!/bin/bash
# Usage: cat checksums.txt | script/scoop-gen <version> <json-file>
set -e
tagname="${1?}"
version="${tagname#v}"
urlprefix="https://github.com/cli/cli/releases/download/$tagname/"
jsonfile="${2?}"
jq_args=(
--arg version "$version"
$(cat | awk '
/windows_386/ {
printf "--arg win32hash \"%s\"\n", $1
printf "--arg win32file \"%s\"\n", $2
}
/windows_amd64/ {
printf "--arg win64hash \"%s\"\n", $1
printf "--arg win64file \"%s\"\n", $2
}
')
)
jq '
.version = $version |
.architecture."32bit".url = $win32file |
.architecture."32bit".hash = $win32hash |
.architecture."64bit".url = $win64file |
.architecture."64bit".hash = $win64hash
' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~