mirror of
https://github.com/YunoHost-Apps/searxng_ynh.git
synced 2024-09-03 20:26:00 +02:00
Merge pull request #278 from YunoHost-Apps/master-promotion
Upgrade master from testing
This commit is contained in:
commit
2ebaa8a2a1
8 changed files with 25 additions and 143 deletions
64
.github/workflows/updater.sh
vendored
64
.github/workflows/updater.sh
vendored
|
@ -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
|
57
.github/workflows/updater.yml
vendored
57
.github/workflows/updater.yml
vendored
|
@ -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 <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
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
|
|
@ -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"
|
||||
|
@ -18,7 +18,7 @@ userdoc = "https://docs.searxng.org/user/"
|
|||
code = "https://github.com/searxng/searxng"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.9"
|
||||
yunohost = ">= 11.2.14.1"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
|
@ -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]
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
repo_fullpath="https://github.com/searxng/searxng"
|
||||
commit_sha="ec41b535876c7906871ea25638837db3dbc5e4ab"
|
||||
|
||||
#=================================================
|
||||
# UWSGI HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -16,6 +16,8 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
repo_fullpath=$(ynh_read_manifest --manifest_key="upstream.code")
|
||||
commit_sha=$(ynh_read_manifest --manifest_key="resources.sources.main.url" | xargs basename --suffix=".tar.gz")
|
||||
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"
|
||||
|
|
|
@ -49,6 +49,8 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
ynh_secure_remove --file="$install_dir/searxng-src"
|
||||
repo_fullpath=$(ynh_read_manifest --manifest_key="upstream.code")
|
||||
commit_sha=$(ynh_read_manifest --manifest_key="resources.sources.main.url" | xargs basename --suffix=".tar.gz")
|
||||
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"
|
||||
|
|
|
@ -15,8 +15,3 @@ test_format = 1.0
|
|||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
test_upgrade_from.9de9cc90.name = "2023.09.17.22.15.57~ynh1 / packaging v1"
|
||||
test_upgrade_from.9de9cc90.args.domain = "domain.tld"
|
||||
test_upgrade_from.9de9cc90.args.path = "/path"
|
||||
test_upgrade_from.9de9cc90.args.is_public = 1
|
||||
test_upgrade_from.9de9cc90.args.admin = "john"
|
||||
|
|
Loading…
Reference in a new issue