Update description, disclaimer, and automated updates

This commit is contained in:
Florent 2023-01-04 16:03:46 +01:00 committed by Florent F
parent 222941fc87
commit 4c1b0ed47d
10 changed files with 85 additions and 64 deletions

View file

@ -9,9 +9,6 @@
# Since each app is different, maintainers can adapt its contents so as to perform # Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected. # 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 LATEST RELEASE AND ITS ASSETS
#================================================= #=================================================
@ -21,7 +18,6 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') 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) # 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) 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 # 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. # Sometimes the release name starts with a "v", so let's filter it out.
@ -49,38 +45,28 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
fi fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) # Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)" echo "1 available asset(s)"
#================================================= #=================================================
# UPDATE SOURCE FILES # UPDATE SOURCE FILES
#================================================= #=================================================
# Here we use the $assets variable to get the resources published in the upstream release. for arch in "x64" "arm64"; do
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. asset_url="https://artifacts.opensearch.org/releases/bundle/opensearch/$version/opensearch-$version-linux-$arch.tar.gz"
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url" echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory # 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) # 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 # Leave $src empty to ignore the asset
case $asset_url in case $arch in
*"admin"*) "x64")
src="app" src="amd64"
;; ;;
*"update"*) "arm64")
src="app-upgrade" src="arm64"
;;
*)
src=""
;; ;;
esac esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory # Create the temporary directory
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
@ -92,12 +78,7 @@ checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory # Delete temporary directory
rm -rf $tempdir rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file # Rewrite source file
cat <<EOT > conf/$src.src cat <<EOT > conf/$src.src
@ -110,10 +91,6 @@ SOURCE_FILENAME=
EOT EOT
echo "... conf/$src.src updated" echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done done
#================================================= #=================================================

49
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# 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@v2
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@v3
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 }}
draft: false

6
conf/amd64.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.4.1/opensearch-2.4.1-linux-x64.tar.gz
SOURCE_SUM=f2b71818ad84cdab1b736211efbdd79d33835a92d46f66a237fa1182d012410d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.4.0/opensearch-2.4.0-linux-x64.tar.gz
SOURCE_SUM=82bee5f68ea3d74a7d835d35f1479509b8497d01c1ae758a4737f5ea799e38e8
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true

6
conf/arm64.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://artifacts.opensearch.org/releases/bundle/opensearch/2.4.1/opensearch-2.4.1-linux-arm64.tar.gz
SOURCE_SUM=fa3151423ce747ed8e1d7afa7d84418e4f216f753e8e300d49a373f0cdc78ec3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,9 +1,6 @@
Some long and extensive description of what the app is and does, lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. OpenSearch makes it easy to ingest, search, visualize, and analyze your data.
### Features ### Features
- Ut enim ad minim veniam, quis nostrud exercitation ullamco ; OpenSearch is a scalable, flexible, and extensible open-source software suite for search, analytics, and observability applications licensed under Apache 2.0. Powered by Apache Lucene and driven by the OpenSearch Project community, OpenSearch offers a vendor-agnostic toolset you can use to build secure, high-performance, cost-efficient applications. Use OpenSearch as an end-to-end solution or connect it with your preferred open-source tools or partner projects.
- Laboris nisi ut aliquip ex ea commodo consequat ;
- Duis aute irure dolor in reprehenderit in voluptate ;
- Velit esse cillum dolore eu fugiat nulla pariatur ;
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."

View file

@ -1,12 +1,4 @@
* Any known limitations, constrains or stuff not working, such as (but not limited to): ### Limitations
* requiring a full dedicated domain ? - Currently the security is disabled
* architectures not supported ? - Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
* not-working single-sign on or LDAP integration ? - Not scalable for now
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?

View file

@ -6,7 +6,7 @@
"en": "Open source distributed and RESTful search engine.", "en": "Open source distributed and RESTful search engine.",
"fr": "Moteur de recherche RESTful et open-source." "fr": "Moteur de recherche RESTful et open-source."
}, },
"version": "1.0~ynh1", "version": "2.4.1~ynh1",
"url": "https://github.com/opensearch-project/OpenSearch", "url": "https://github.com/opensearch-project/OpenSearch",
"upstream": { "upstream": {
"license": "Apache-2.0", "license": "Apache-2.0",

View file

@ -77,7 +77,7 @@ ynh_script_progression --message="Setting up source files..." --weight=15
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"

View file

@ -94,7 +94,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=20 ynh_script_progression --message="Upgrading source files..." --weight=20
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep="config/opensearch.yml config/jvm.options.d/yunohost.conf" ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH" --keep="config/opensearch.yml config/jvm.options.d/yunohost.conf"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"