Support dynamic resource selection
This commit is contained in:
parent
c16e517a9c
commit
040f83561c
6 changed files with 29 additions and 11 deletions
|
|
@ -9,7 +9,7 @@ mkdir --parents "${STATE_DIR}"
|
|||
github_update() {
|
||||
package="$1"
|
||||
repo="$2"
|
||||
resource="$3"
|
||||
resource_selector="$3"
|
||||
post_fetch="$4"
|
||||
|
||||
response=$(curl --silent "https://api.github.com/repos/${repo}/releases/latest")
|
||||
|
|
@ -31,6 +31,9 @@ github_update() {
|
|||
fi
|
||||
|
||||
if [ "${install}" = "true" ]; then
|
||||
echo "\"${latest_version}\""
|
||||
resource=$(${resource_selector} "${latest_version}")
|
||||
echo "\"${resource}\""
|
||||
asset=$(printf '%s' "${response}" | jq --raw-output ".assets[] | select(.name == \"${resource}\").browser_download_url")
|
||||
curl --location "${asset}" | "${post_fetch}" && \
|
||||
echo "${latest_version}" > "${VERSION_FILE}" && \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue