Support installing a specific project release

This commit is contained in:
Ohad Livne 2026-02-10 13:45:18 +02:00
parent f193d626ab
commit ca7c6be4fe
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D

View file

@ -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"