mirror of
https://github.com/YunoHost-Apps/nodered_ynh.git
synced 2024-09-03 19:46:25 +02:00
Fix updater logics
This commit is contained in:
parent
b5526e2e2e
commit
45c171b14d
2 changed files with 6 additions and 11 deletions
9
.github/workflows/updater.sh
vendored
9
.github/workflows/updater.sh
vendored
|
@ -24,15 +24,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.)
|
||||||
|
@ -122,5 +124,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
|
||||||
|
|
8
.github/workflows/updater.yml
vendored
8
.github/workflows/updater.yml
vendored
|
@ -25,14 +25,6 @@ jobs:
|
||||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||||
# Run the updater script
|
# Run the updater script
|
||||||
./.github/workflows/updater.sh
|
./.github/workflows/updater.sh
|
||||||
retval=$?
|
|
||||||
# Check if we are allowed to proceed
|
|
||||||
if [ $retval -eq 0 ]; then
|
|
||||||
echo "PROCEED=true" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "PROCEED=false" >> $GITHUB_ENV
|
|
||||||
echo "::warning ::The updater script failed (exit code $retval)"
|
|
||||||
fi
|
|
||||||
# Commit
|
# Commit
|
||||||
git commit -am "Upgrade to v$VERSION"
|
git commit -am "Upgrade to v$VERSION"
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
|
|
Loading…
Add table
Reference in a new issue