Fix version extraction in get_latest_version function
This commit is contained in:
parent
6d4987e067
commit
783cb17e40
1 changed files with 4 additions and 17 deletions
|
|
@ -51,7 +51,7 @@ get_latest_version() {
|
||||||
local latest_version
|
local latest_version
|
||||||
latest_version=$(curl -s --max-time 10 https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/latest | \
|
latest_version=$(curl -s --max-time 10 https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/latest | \
|
||||||
grep -o '"tag_name":"v[0-9.]*' | \
|
grep -o '"tag_name":"v[0-9.]*' | \
|
||||||
sed -E 's/"tag_name":"v//g' || true)
|
sed -E 's/"tag_name":"v//g')
|
||||||
|
|
||||||
if [ -z "$latest_version" ]; then
|
if [ -z "$latest_version" ]; then
|
||||||
log "ERROR: Failed to retrieve the latest version from Codeberg API."
|
log "ERROR: Failed to retrieve the latest version from Codeberg API."
|
||||||
|
|
@ -61,17 +61,9 @@ get_latest_version() {
|
||||||
echo "$latest_version"
|
echo "$latest_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get current Forgejo version and image
|
# Get current version
|
||||||
get_current_image_details() {
|
get_current_version() {
|
||||||
local current_image
|
docker inspect --format='{% raw %}{{.Config.Image}}{% endraw %}' forgejo | cut -d':' -f2
|
||||||
current_image=$(docker inspect --format='{% raw %}{{.Config.Image}}{% endraw %}' forgejo || true)
|
|
||||||
|
|
||||||
if [ -z "$current_image" ]; then
|
|
||||||
log "ERROR: Failed to retrieve the current Forgejo image."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$current_image"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update Forgejo to the latest version
|
# Update Forgejo to the latest version
|
||||||
|
|
@ -117,11 +109,6 @@ update_forgejo() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get current version
|
|
||||||
get_current_version() {
|
|
||||||
docker inspect --format='{% raw %}{{.Config.Image}}{% endraw %}' forgejo | cut -d':' -f2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main execution
|
# Main execution
|
||||||
log "=== Forgejo Auto-Update Script Started ==="
|
log "=== Forgejo Auto-Update Script Started ==="
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue