1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fider_ynh.git synced 2024-09-03 18:36:11 +02:00

Fix updater logics

This commit is contained in:
tituspijean 2021-09-11 22:11:35 +02:00
parent 33a1d90082
commit e7a97667e7

View file

@ -27,15 +27,17 @@ assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[
echo "Current version: $current_version" echo "Current version: $current_version"
echo "Latest release from upstream: $version" echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one # Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available" echo "::warning ::No new version available"
exit 1 exit 0
# Proceed only if a PR for this new version does not already exist # Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update" echo "::warning ::A branch already exists for this update"
exit 1 exit 0
fi fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) # Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
@ -125,5 +127,6 @@ jq -s --indent 4 ".[] | .version = \"$VERSION~ynh1\"" manifest.json | sponge man
# No need to update the README, yunohost-bot takes care of it # No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if a 0 exit code is returned # The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0 exit 0