diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100755 index 0000000..ea6c155 --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,129 @@ +#!/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. + +# Remove this exit command when you are ready to run this Action +#exit 1 + +#================================================= +# 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) +assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) + +# Later down the script, we assume the version has only digits and dots +# Sometimes the release name starts with a "v", so let's filter it out. +# You may need more tweaks here if the upstream repository has different naming conventions. +if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then + version=${version:1} +fi + +# 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 + +# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) +echo "${#assets[@]} available asset(s)" + +#================================================= +# UPDATE SOURCE FILES +#================================================= + +# Here we use the $assets variable to get the resources published in the upstream release. +# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. + +# Let's loop over the array of assets URLs +for asset_url in ${assets[@]}; do + +echo "Handling asset at $asset_url" + +# Assign the asset to a source file in conf/ directory +# 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 +case $asset_url in + *"fluxbb-"*".tar.gz") + src="app" + ;; +esac + +# If $src is not empty, let's process the asset +if [ ! -z "$src" ]; then + +# 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 + +# Get extension +if [[ $filename == *.tar.gz ]]; then + extension=tar.gz +else + extension=${filename##*.} +fi + +# Rewrite source file +cat < conf/$src.src +SOURCE_URL=$asset_url +SOURCE_SUM=$checksum +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=$extension +SOURCE_IN_SUBDIR=true +EOT +echo "... conf/$src.src updated" + +else +echo "... asset ignored" +fi + +done + +#================================================= +# 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 diff --git a/README.md b/README.md index e973afd..8b9683e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in FluxBB is designed as a lighter, faster alternative to some of the traditional feature heavy forum applications. It is easy to use and has a proven track record of stability and security making it an ideal choice of forum for your website. -**Shipped version:** 1.5.11~ynh4 +**Shipped version:** 1.5.11~ynh5 **Demo:** https://fluxbb.org/forums/index.php @@ -34,8 +34,8 @@ HTTP and LDAP authentication are not supported. ## Documentation and resources * Official app website: https://fluxbb.org/ -* Official user documentation: https://yunohost.org/en/app_fluxbb * Official admin documentation: https://fluxbb.org/docs/ +* Upstream app code repository: https://github.com/fluxbb/fluxbb/ * YunoHost documentation for this app: https://yunohost.org/app_fluxbb * Report a bug: https://github.com/YunoHost-Apps/fluxbb_ynh/issues diff --git a/README_fr.md b/README_fr.md index d3e99ef..669b8ab 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,10 +11,9 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -FluxBB is designed as a lighter, faster alternative to some of the traditional feature heavy forum applications. It is easy to use and has a proven track record of stability and security making it an ideal choice of forum for your website. +FluxBB est conçu comme une alternative plus légère et plus rapide à certaines des applications traditionnelles de forum lourdes en fonctionnalités. Il est facile à utiliser et a fait ses preuves en matière de stabilité et de sécurité, ce qui en fait un choix de forum idéal pour votre site Web. - -**Version incluse :** 1.5.11~ynh4 +**Version incluse :** 1.5.11~ynh5 **Démo :** https://fluxbb.org/forums/index.php @@ -24,14 +23,14 @@ FluxBB is designed as a lighter, faster alternative to some of the traditional f ## Avertissements / informations importantes -### Limitations with YunoHost +### Limitations avec YunoHost -HTTP and LDAP authentication are not supported. +Les authentifications HTTP et LDAP ne sont pas prises en charge. ## Documentations et ressources * Site officiel de l'app : https://fluxbb.org/ -* Documentation officielle utilisateur : https://yunohost.org/en/app_fluxbb * Documentation officielle de l'admin : https://fluxbb.org/docs/ +* Dépôt de code officiel de l'app : https://github.com/fluxbb/fluxbb/ * Documentation YunoHost pour cette app : https://yunohost.org/app_fluxbb * Signaler un bug : https://github.com/YunoHost-Apps/fluxbb_ynh/issues diff --git a/check_process b/check_process index 0e4d873..21f632b 100644 --- a/check_process +++ b/check_process @@ -5,7 +5,6 @@ admin="john" is_public=1 password="password_fluxbb" - port="666" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -14,7 +13,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=6a8fea2965da32112d10a659637e3b1cd0b2c61c + #upgrade=1 from_commit=6a8fea2965da32112d10a659637e3b1cd0b2c61c backup_restore=1 multi_instance=1 change_url=1 diff --git a/conf/app.src b/conf/app.src index 7a9849a..d5dde2e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://fluxbb.org/download/releases/1.5.11/fluxbb-1.5.11.tar.gz -SOURCE_SUM=dacc6ae22fc8a6183b47e7e0ddc7d0a0a75b6c7203efc2194fd3af32c65a734f +SOURCE_URL=https://github.com/fluxbb/fluxbb/archive/refs/tags/fluxbb-1.5.11.tar.gz +SOURCE_SUM=af464ebebb739a9aec7afbe30edf0c6afdcd7df711a73f98fb814b2bffe4bb9e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/config.php b/conf/config.php deleted file mode 100644 index c3536ee..0000000 --- a/conf/config.php +++ /dev/null @@ -1,17 +0,0 @@ -= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index 5fbf042..337f73c 100755 --- a/scripts/install +++ b/scripts/install @@ -25,6 +25,7 @@ path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC password=$YNH_APP_ARG_PASSWORD +email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -109,7 +110,7 @@ ynh_systemd_action --service_name=nginx --action=reload # Installation with cURL ynh_script_progression --message="Finalizing installation..." -ynh_local_curl "/install.php" "form_sent=1" "install_lang=English" "req_db_type=mysqli_innodb" "req_db_host=localhost" "req_db_name=$db_name" "db_username=$db_user" "db_password=$db_pwd" "db_prefix=fl_" "req_username=$admin" "req_password1=$password" "req_password2=$password" "req_email=$admin@$domain" "req_title=YunoFluxBB" "desc=FluxBB_package_for_Yunohost" "req_base_url=https://$domain$path_url" "req_default_lang=English" "req_default_style=Air" +ynh_local_curl "/install.php" "form_sent=1" "install_lang=English" "req_db_type=mysqli_innodb" "req_db_host=localhost" "req_db_name=$db_name" "db_username=$db_user" "db_password=$db_pwd" "db_prefix=fl_" "req_username=$admin" "req_password1=$password" "req_password2=$password" "req_email=$email" "req_title=YunoFluxBB" "desc=FluxBB_package_for_Yunohost" "req_base_url=https://$domain$path_url" "req_default_lang=English" "req_default_style=Air" ynh_secure_remove "$final_path/install.php" diff --git a/scripts/restore b/scripts/restore index 90e99b3..61c68f7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -36,8 +36,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " +test ! -d $final_path || ynh_die "There is already a directory: $final_path " #================================================= # RESTORE THE NGINX CONFIGURATION