From 5bb9bcd6961534f82086f9a58d15ad7cd85f39a7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 5 Apr 2023 20:20:01 +0200 Subject: [PATCH 1/9] manifest: fix regex for autoupdate.. --- manifest.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 17d91f0..bffa5c7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,10 +57,10 @@ ram.runtime = "50M" i386.sha256 = "c4ddd0c9f1d9216ff15e0fbcb53f9da0999d0a3e84b2e270601aa86c8ff6f00c" autoupdate.strategy = "latest_github_release" - autoupdate.asset.amd64 = "gogs_*_linux_amd64.tar.gz" - autoupdate.asset.arm64 = "gogs_*_linux_armv8.tar.gz" - autoupdate.asset.i386 = "gogs_*_linux_386.tar.gz" - autoupdate.asset.armhf = "gogs_*_linux_armv7.tar.gz" + autoupdate.asset.amd64 = "gogs_.*_linux_amd64.tar.gz" + autoupdate.asset.arm64 = "gogs_.*_linux_armv8.tar.gz" + autoupdate.asset.i386 = "gogs_.*_linux_386.tar.gz" + autoupdate.asset.armhf = "gogs_.*_linux_armv7.tar.gz" [resources.ports] From b25c64d2859a7ef4f375403d8043f3a216b42647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 9 May 2023 11:49:45 +0200 Subject: [PATCH 2/9] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index bffa5c7..db6d537 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://gogs.io/docs" code = "https://github.com/gogs/gogs" [integration] -yunohost = ">= 11.1.17" +yunohost = ">= 11.1.19" architectures = "all" multi_instance = true ldap = true From 893f4022df2a7094f656ea73c4f30540e7ecc49b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 13 May 2023 08:11:42 +0200 Subject: [PATCH 3/9] Update install --- scripts/install | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/install b/scripts/install index f3c008a..a553695 100644 --- a/scripts/install +++ b/scripts/install @@ -15,12 +15,6 @@ source /usr/share/yunohost/helpers # Retrieve arguments key=$(ynh_string_random) - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 - ynh_app_setting_set --app=$app --key=key --value=$key #================================================= From 3b133bbf2a6149dc2718ceb6c62a22a7a678b4eb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 13 May 2023 08:13:01 +0200 Subject: [PATCH 4/9] Update ADMIN.md --- doc/ADMIN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 1efaaab..153e3b3 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -12,7 +12,7 @@ UsePAM no You also need to add your public key to your Gogs profile. -If you use SSH on another port than 22, you need to add theses lines to your ssh config in `~/.ssh/config`: +If you use SSH on another port than 22, you need to add theses lines to your SSH config in `~/.ssh/config`: ```bash Host domain.tld From eef5df5c1f36dc0f75d53b6cdb5a41c18e8c862e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 18 Aug 2023 22:29:49 +0200 Subject: [PATCH 5/9] cleaning --- manifest.toml | 2 +- scripts/install | 21 ++------------------- scripts/remove | 20 -------------------- scripts/restore | 21 ++------------------- 4 files changed, 5 insertions(+), 59 deletions(-) diff --git a/manifest.toml b/manifest.toml index db6d537..8b7ac17 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://gogs.io/docs" code = "https://github.com/gogs/gogs" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.2" architectures = "all" multi_instance = true ldap = true diff --git a/scripts/install b/scripts/install index a553695..5c74dba 100644 --- a/scripts/install +++ b/scripts/install @@ -30,14 +30,6 @@ mkdir -p "$install_dir/custom/conf/auth.d" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # ADD A CONFIGURATION #================================================= @@ -65,12 +57,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Configure init script ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +# Create a dedicated NGINX config +ynh_add_nginx_config # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -78,11 +66,6 @@ ynh_use_logrotate chown -R $app:$app "/var/log/$app" chmod u=rwX,g=rX,o= "/var/log/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Lightweight Git forge" --log="/var/log/$app/$app.log" #================================================= diff --git a/scripts/remove b/scripts/remove index c546491..9bc2a2a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,35 +22,15 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - ynh_secure_remove --file="/var/log/$app" #================================================= diff --git a/scripts/restore b/scripts/restore index a3c0189..f170809 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,15 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -49,25 +40,17 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/var/log/$app" chown -R $app:$app "/var/log/$app" chmod u=rwX,g=rX,o= "/var/log/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Lightweight Git forge" --log="/var/log/$app/$app.log" #================================================= From 38636e4cdca94617b0b5dd672e593fbbce7e70e4 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 28 Sep 2023 21:17:44 +0000 Subject: [PATCH 6/9] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 30c74a6..e9bddab 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index a74d0ae..25f4266 100644 --- a/README_fr.md +++ b/README_fr.md @@ -32,7 +32,6 @@ Gogs (Go Git Service) est une forge multiplateforme basée sur git écrite en Go * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs From f64a736601531ae9e99b20578a9886db9f7b4399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 28 Sep 2023 23:21:30 +0200 Subject: [PATCH 7/9] cleaning --- .github/workflows/updater.sh | 138 ---------------------------------- .github/workflows/updater.yml | 49 ------------ manifest.toml | 2 - scripts/change_url | 2 +- scripts/remove | 5 +- scripts/restore | 9 +-- scripts/upgrade | 23 +----- 7 files changed, 9 insertions(+), 219 deletions(-) delete mode 100755 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100755 index 44d4388..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/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 - *"gogs_"*"_linux_amd64.tar.gz") - src="amd64" - ;; - *"gogs_"*"_linux_armv8.tar.gz") - src="arm64" - ;; - *"gogs_"*"_linux_armv7.tar.gz") - src="armhf" - ;; - *"gogs_"*"_linux_386.tar.gz") - src="i386" - ;; -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/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a56d7cb..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - /bin/bash .github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - base: testing - branch: ci-auto-update-v${{ env.VERSION }} - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - draft: false diff --git a/manifest.toml b/manifest.toml index 8b7ac17..0a98b70 100644 --- a/manifest.toml +++ b/manifest.toml @@ -38,8 +38,6 @@ ram.runtime = "50M" type = "user" [install.init_main_permission] - help.en = "If enabled, Gogs will be accessible by people who do not have an account. This can be changed later via the webadmin." - help.fr = "Si cette case est cochée, Gogs sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." type = "group" default = "visitors" diff --git a/scripts/change_url b/scripts/change_url index c42a529..6d45f10 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/remove b/scripts/remove index 9bc2a2a..3c14eef 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null diff --git a/scripts/restore b/scripts/restore index f170809..fac91e1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -56,17 +56,10 @@ yunohost service add $app --description="Lightweight Git forge" --log="/var/log/ #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=3 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1b41366..b7ddd1d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,39 +36,24 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# SETUP SYSTEMD +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - # Use logrotate to manage application logfile(s) ynh_use_logrotate chown -R $app:$app "/var/log/$app" chmod u=rwX,g=rX,o= "/var/log/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 - yunohost service add $app --description="Lightweight Git forge" --log="/var/log/$app/$app.log" #================================================= From 37cc0ca22e17f4809a4c3b33dad932c0e1d39aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 29 Sep 2023 08:50:10 +0200 Subject: [PATCH 8/9] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 0a98b70..cf356f9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Gogs" description.en = "Lightweight self-hosted Git forge" description.fr = "Forge Git légère auto-hébergé" -version = "0.13.0~ynh2" +version = "0.13.0~ynh3" maintainers = [] From 510a1f640680a3e573d0ba83d37552dfa146d3d6 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 29 Sep 2023 06:50:15 +0000 Subject: [PATCH 9/9] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9bddab..25d8591 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Gogs (Go Git Service) is a git-based multiplatform forge written in Go. Its part - Authentication via SMTP, LDAP. -**Shipped version:** 0.13.0~ynh2 +**Shipped version:** 0.13.0~ynh3 **Demo:** https://try.gogs.io/user/login diff --git a/README_fr.md b/README_fr.md index 25f4266..6592546 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Gogs (Go Git Service) est une forge multiplateforme basée sur git écrite en Go. Sa particularité est d’être léger et pouvant fonctionner sur carte ARM, ce qui fait qu’il est adapté à l’auto-hébergement. Gogs a une interface web similaire à celle de GitHub. -**Version incluse :** 0.13.0~ynh2 +**Version incluse :** 0.13.0~ynh3 **Démo :** https://try.gogs.io/user/login