mirror of
https://github.com/YunoHost-Apps/ghost_ynh.git
synced 2024-09-03 19:16:02 +02:00
Fix auto-updater
This commit is contained in:
parent
588a72ea1f
commit
886768dd42
1 changed files with 5 additions and 12 deletions
17
.github/workflows/updater.sh
vendored
17
.github/workflows/updater.sh
vendored
|
@ -18,7 +18,7 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||||
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
|
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").zipball_url ] | join(" ") | @sh' | tr -d "'"))
|
||||||
|
|
||||||
admin_repo="TryGhost/Admin"
|
admin_repo="TryGhost/Admin"
|
||||||
assets+=("https://github.com/TryGhost/Admin/archive/refs/tags/${version}.zip")
|
assets+=("https://github.com/TryGhost/Admin/archive/refs/tags/${version}.zip")
|
||||||
|
@ -67,7 +67,7 @@ echo "Handling asset at $asset_url"
|
||||||
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
||||||
# Leave $src empty to ignore the asset
|
# Leave $src empty to ignore the asset
|
||||||
case $asset_url in
|
case $asset_url in
|
||||||
*"Ghost-"*".zip")
|
*"/Ghost/"*)
|
||||||
src="app"
|
src="app"
|
||||||
;;
|
;;
|
||||||
*"/Admin/"*)
|
*"/Admin/"*)
|
||||||
|
@ -92,19 +92,12 @@ checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||||
# Delete temporary directory
|
# Delete temporary directory
|
||||||
rm -rf $tempdir
|
rm -rf $tempdir
|
||||||
|
|
||||||
# Get extension
|
|
||||||
if [[ $filename == *.tar.gz ]]; then
|
|
||||||
extension=tar.gz
|
|
||||||
else
|
|
||||||
extension=${filename##*.}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rewrite source file
|
# Rewrite source file
|
||||||
cat <<EOT > conf/$src.src
|
cat <<EOT > conf/$src.src
|
||||||
SOURCE_URL=$asset_url
|
SOURCE_URL=$asset_url
|
||||||
SOURCE_SUM=$checksum
|
SOURCE_SUM=$checksum
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=$extension
|
SOURCE_FORMAT=zip
|
||||||
SOURCE_IN_SUBDIR=false
|
SOURCE_IN_SUBDIR=false
|
||||||
EOT
|
EOT
|
||||||
echo "... conf/$src.src updated"
|
echo "... conf/$src.src updated"
|
||||||
|
@ -117,8 +110,8 @@ fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $count == 0 ]; then
|
if [ $count -lt 2 ]; then
|
||||||
echo "::warning ::None of the assets were processed."
|
echo "::warning ::Some assets were not processed."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue