Support installing a specific project release
This commit is contained in:
parent
69126123ff
commit
667914aecf
1 changed files with 11 additions and 3 deletions
|
|
@ -11,16 +11,24 @@ github_update() {
|
||||||
repo="$2"
|
repo="$2"
|
||||||
resource_selector="$3"
|
resource_selector="$3"
|
||||||
post_fetch="$4"
|
post_fetch="$4"
|
||||||
|
override_tag="${5:-}"
|
||||||
|
|
||||||
response=$(curl --silent "https://api.github.com/repos/${repo}/releases/latest")
|
if [ -z "${override_tag}" ]; then
|
||||||
latest_version=$(printf '%s' "${response}" | jq --raw-output .name)
|
response=$(curl --silent "https://api.github.com/repos/${repo}/releases/latest")
|
||||||
|
latest_version=$(printf '%s' "${response}" | jq --raw-output .name)
|
||||||
|
version_type="Latest version"
|
||||||
|
else
|
||||||
|
response=$(curl --silent "https://api.github.com/repos/${repo}/releases/tags/${override_tag}")
|
||||||
|
latest_version="${override_tag}"
|
||||||
|
version_type="Fixed version"
|
||||||
|
fi
|
||||||
VERSION_FILE="${STATE_DIR}/${package}"
|
VERSION_FILE="${STATE_DIR}/${package}"
|
||||||
|
|
||||||
install="false"
|
install="false"
|
||||||
if [ -f "${VERSION_FILE}" ]; then
|
if [ -f "${VERSION_FILE}" ]; then
|
||||||
installed_version=$(cat "${VERSION_FILE}")
|
installed_version=$(cat "${VERSION_FILE}")
|
||||||
if [ "${installed_version}" = "${latest_version}" ]; then
|
if [ "${installed_version}" = "${latest_version}" ]; then
|
||||||
echo "Latest version \"${package} ${installed_version}\" is already installed"
|
echo "${version_type} \"${package} ${installed_version}\" is already installed"
|
||||||
else
|
else
|
||||||
echo "Upgrading \"${package} ${installed_version}\" -> \"${package} ${latest_version}\"..."
|
echo "Upgrading \"${package} ${installed_version}\" -> \"${package} ${latest_version}\"..."
|
||||||
install="true"
|
install="true"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue