diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100755 index 362ef37..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,64 +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. - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.toml | tomlq -j '.version|split("~")[0]') -repo=$(cat manifest.toml | tomlq -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_raw=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r ".commit.committer.date") -version=$(date -d "$version_raw" +%Y.%m.%d.%H.%M.%S) -commit_hash=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r ".sha") - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -echo "REPO=$repo" >> $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 -#================================================= - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Replace new version in _common.sh -sed -i "s/^commit_sha=.*/commit_sha=\"$commit_hash\"/" scripts/_common.sh - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -sed -i "s/^version = .*/version = \"$version~ynh1\"/" manifest.toml - -# 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 b79383a..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,57 +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@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install yq/tomlq - id: install_yq - run: pip install yq - - 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 to testing - id: cpr-testing - 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 }} - [See upstream release page](https://github.com/${{ env.REPO }}/releases/tag/v${{ env.VERSION }}) - draft: false diff --git a/conf/nginx.conf b/conf/nginx.conf index b4b159f..f5a4eb9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,19 +1,19 @@ location __PATH__/ { - uwsgi_pass unix:///var/run/__APP__/app.socket; + uwsgi_pass unix:///var/run/__APP__/app.socket; - include uwsgi_params; - uwsgi_param HTTP_HOST $host; - uwsgi_param HTTP_CONNECTION $http_connection; + include uwsgi_params; + uwsgi_param HTTP_HOST $host; + uwsgi_param HTTP_CONNECTION $http_connection; - # see flaskfix.py - uwsgi_param HTTP_X_SCHEME $scheme; - uwsgi_param HTTP_X_SCRIPT_NAME /searxng; + # see flaskfix.py + uwsgi_param HTTP_X_SCHEME $scheme; + uwsgi_param HTTP_X_SCRIPT_NAME /searxng; - # see limiter.py - uwsgi_param HTTP_X_REAL_IP $remote_addr; - uwsgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for; + # see limiter.py + uwsgi_param HTTP_X_REAL_IP $remote_addr; + uwsgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/manifest.toml b/manifest.toml index 189558d..a15be7e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ description.fr = "Un méta-moteur de recherche qui rassemble les résultats de p version = "2024.05.17.07.51.17~ynh1" -maintainers = ["mh4ckt3mh4ckt1c4s"] +maintainers = ["mh4ckt3mh4ckt1c4s", "ewilly"] [upstream] license = "AGPL-3.0-or-later" @@ -40,6 +40,13 @@ ram.runtime = "200M" default = "visitors" [resources] + [resources.sources] + + [resources.sources.main] + url = "https://github.com/searxng/searxng/archive/f5eb56b63f250c7804e5e1cf4426e550bc933906.tar.gz" + sha256 = "5424c916ba6312fb22d14b7eac268e40995bda073e480b3e6c8e9d63dcd5e087" + autoupdate.strategy = "latest_github_commit" + [resources.system_user] [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index 40ed39f..15c1ebe 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -repo_fullpath="https://github.com/searxng/searxng" -commit_sha="ec41b535876c7906871ea25638837db3dbc5e4ab" - #================================================= # UWSGI HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 71cfebc..3f6664d 100755 --- a/scripts/install +++ b/scripts/install @@ -16,10 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_exec_fully_quiet git clone -n "$repo_fullpath" "$install_dir/searxng-src" -pushd "$install_dir/searxng-src" - ynh_exec_fully_quiet git checkout "$commit_sha" -popd +ynh_setup_source --dest_dir="$install_dir/searxng-src" ynh_script_progression --message="Installing SearXNG..." --weight=2 diff --git a/scripts/upgrade b/scripts/upgrade index d26e0ab..a9887d3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,10 +49,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_secure_remove --file="$install_dir/searxng-src" - ynh_exec_fully_quiet git clone -n "$repo_fullpath" "$install_dir/searxng-src" - pushd "$install_dir/searxng-src" - ynh_exec_fully_quiet git checkout "$commit_sha" - popd + ynh_setup_source --dest_dir="$install_dir/searxng-src" ynh_secure_remove --file="$install_dir/searxng-pyenv" python3 -m venv --system-site-packages "$install_dir/searxng-pyenv"