1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00
wallabag2_ynh/.github/workflows/updater.sh
lapineige 41fb3044b8
Testing : v2.5.4 + add auto-updater + add logrotate (#164)
* Apply last example_ynh (#117)

* Apply last example_ynh

* Cleanup backup

* Create DISCLAIMER.md

* Create DISCLAIMER_fr.md

* Auto-update README

* Add files via upload

* Fix heading size

* Auto-update README

* Fix heading size

* Auto-update README

* Fix charset

* Auto-update README

* Update check_process

* 2.4.3 (#125)

* Upgrade to 2.4.2~ynh1

* Fix craue_config_setting

* Upgrade to 2.4.3~ynh1

* Upgrade to 2.4.3~ynh1

* Auto-update README

Co-authored-by: yalh76 <yalh@yahoo.com>
Co-authored-by: Yunohost-Bot <>

* Specify PHP version in every calls (#132)

* Specify PHP version in every calls

* Switch (back) to php7.4

* Add PHP-xml dependency for DOM extension

Co-authored-by: lapineige <lapineige@users.noreply.github.com>

* Auto-update README

* Fix php version reference (#136)

* Auto-update README

* Use YNH_PHP_VERSION

* Proper YNH_PHP_VERSION syntax

* Proper YNH_PHP_VERSION syntax : typo

* YNH_PHP_VERSION: fix missing change

* Fix phpversion → YNH_PHP_VERSION

* Upgrade to 2.5 (#134)

* Upgrade to 2.5

* Auto-update README

* Upgrade to 2.5

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Merge master (2.4.3/php7.4) into testing (2.5) (#137)

* Testing (#124)

* Apply last example_ynh (#117)

* Apply last example_ynh

* Cleanup backup

* Create DISCLAIMER.md

* Create DISCLAIMER_fr.md

* Auto-update README

* Add files via upload

* Fix heading size

* Auto-update README

* Fix heading size

* Auto-update README

* Fix charset

* Auto-update README

* Update check_process

Co-authored-by: lapineige <lapineige@users.noreply.github.com>
Co-authored-by: Yunohost-Bot <>

* Testing: update to 2.4.3 (#128)

* Apply last example_ynh (#117)

* Apply last example_ynh

* Cleanup backup

* Create DISCLAIMER.md

* Create DISCLAIMER_fr.md

* Auto-update README

* Add files via upload

* Fix heading size

* Auto-update README

* Fix heading size

* Auto-update README

* Fix charset

* Auto-update README

* Update check_process

* 2.4.3 (#125)

* Upgrade to 2.4.2~ynh1

* Fix craue_config_setting

* Upgrade to 2.4.3~ynh1

* Upgrade to 2.4.3~ynh1

* Auto-update README

Co-authored-by: yalh76 <yalh@yahoo.com>
Co-authored-by: Yunohost-Bot <>

* Specify PHP version in every calls (#132)

* Specify PHP version in every calls

* Switch (back) to php7.4

* Add PHP-xml dependency for DOM extension

Co-authored-by: lapineige <lapineige@users.noreply.github.com>

* Auto-update README

* Fix php version reference (#136)

* Auto-update README

* Use YNH_PHP_VERSION

* Proper YNH_PHP_VERSION syntax

* Proper YNH_PHP_VERSION syntax : typo

* YNH_PHP_VERSION: fix missing change

* Fix phpversion → YNH_PHP_VERSION

Co-authored-by: yalh76 <yalh@yahoo.com>
Co-authored-by: Yunohost-Bot <>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>

Co-authored-by: yalh76 <yalh@yahoo.com>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* 2.5 (#138)

* Upgrade to 2.5

* Auto-update README

* Upgrade to 2.5

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update README

* Fix PHP dependencies (#142)

* Switch version to 2.5.0~ynh2

* Auto-update README

* 2.5.1 (#146)

* v2.5.1

* Auto-update README

* v2.5.1

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* fix version number

* Auto-update README

* fix php7.4-redis conflicting with php-redis (#145)

* Auto-update README

* Typo in version number (2.5.1, not 2.5.2)

* Auto-update README

* Setup logrotate (#144)

* Setup logrotate

* Setup logrotate

* Setup logrotate

* Setup logrotate

* Setup logrotate

* bum version number

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update README

* Specify PHP version for Redis (#155)

* Specify PHP version for Redis

Now available in Bullseye

* Auto-update README

* Bump requirement to YNH11 for php${version}-redis

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* 2.5.2 (#158)

* 2.5.2

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* v2.5.2

* Auto-update README

* Add auto-updater (#126)

* 2.5.4 (#163)


* Wallabag 2.5.4

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* v2.5.4 updated

* Auto-update README

---------

Co-authored-by: yalh76 <yalh@yahoo.com>
Co-authored-by: Yunohost-Bot <>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: JimboJoe <jimmy@monin.net>
2023-02-12 11:26:40 +01:00

90 lines
3.2 KiB
Bash

#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
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)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
asset_url="https://static.wallabag.org/releases/wallabag-release-$version.tar.gz"
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
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
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# 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
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# UPDATE SOURCE FILES
#=================================================
echo "Handling asset at $asset_url"
src="app"
extension="tar.gz"
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true
EOT
echo "... conf/$src.src updated"
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0