1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jitsi_ynh.git synced 2024-09-03 19:35:57 +02:00

Continue manifestv2

This commit is contained in:
Salamandar 2024-01-18 14:34:56 +01:00
parent 196d5216ad
commit d1ca660bf2
7 changed files with 67 additions and 330 deletions

View file

@ -1,156 +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.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 ) | .name' | sort -V | tail -1)
package_repository="https://download.jitsi.org/stable"
tempdir="$(mktemp -d)"
curl -o $tempdir/Release "$package_repository/Packages"
dependencies=$(sed -n '/Version: '$version'*/,/Package:/p' $tempdir/Release | grep "^Pre-Depends:" | cut -d " " -f2-)
dependencies="$dependencies, $(sed -n '/Version: '$version'*/,/Package:/p' $tempdir/Release | grep "^Depends:" | cut -d " " -f2-)"
IFS=',' read -ra dependencies_array <<< "$dependencies"
assets=()
for onedependency in "${dependencies_array[@]}"
do
app=$(echo $onedependency | cut -d " " -f1)
appversion=$(echo $onedependency | grep -oP "(?<== ).*(?=\))")
assets+=("$package_repository/${app}_${appversion}_all.deb")
done
rm -rf $tempdir
# 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
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
# 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
*"jitsi-videobridge"*)
src="jitsi-videobridge"
;;
*"jicofo"*)
src="jitsi-jicofo"
;;
*"jitsi-meet-web_"*)
src="jitsi-meet-web"
;;
*"jitsi-meet-prosody"*)
src="jitsi-meet-prosody"
;;
*)
src=""
;;
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 <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=$src.deb
SOURCE_EXTRACT=false
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

View file

@ -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 <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

View file

@ -1,28 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=0
setup_public=1
upgrade=1
# 1.0.4466~ynh1
upgrade=1 from_commit=f967b101803c49655e460bdb2c1b0fb73320d0e3
# 1.0.4466~ynh2
upgrade=1 from_commit=ba635a58f8184b5dd4a6682b8da96909d3d31060
# 1.0.5913~ynh1
upgrade=1 from_commit=12d4758ea7582c9d15d0bd80e2eb5f03ccac8484
# 1.0.5913~ynh3
upgrade=1 from_commit=afbc84d313452267cd97b9df44801d0ae085b1f2
# 2.0.8719~ynh2
upgrade=1 from_commit=4a043dfd46acc078e6c222a83958b2f64f16a79f
backup_restore=1
multi_instance=0
port_already_use=0
change_url=0
;;; Options
Email=yalh@yahoo.com
Notification=all

View file

@ -1,44 +0,0 @@
{
"name": "Jitsi Meet",
"id": "jitsi",
"packaging_format": 1,
"description": {
"en": "Video conferencing web application",
"fr": "Application web de conférence vidéo"
},
"version": "2.0.9164~ynh1",
"url": "https://jitsi.org/Projects/JitMeet",
"upstream": {
"license": "Apache-2.0",
"website": "https://jitsi.org/",
"demo": "https://meet.jit.si/",
"userdoc": "https://jitsi.org/user-faq/",
"code": "https://github.com/jitsi/jitsi-meet",
"cpe": "cpe:2.3:a:jitsi:jitsi"
},
"license": "Apache-2.0",
"maintainer": {
"name": "yalh76"
},
"previous_maintainers": [
{
"name": "ju",
"email": "julien.malik@paraiso.me"
}
],
"requirements": {
"yunohost": ">= 11.0.8"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
}
]
}
}

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2 packaging_format = 2
id = "jitsi" id = "jitsi"
@ -29,6 +31,7 @@ disk = "50M"
ram.build = "50M" ram.build = "50M"
ram.runtime = "50M" ram.runtime = "50M"
[install]
[install.domain] [install.domain]
type = "domain" type = "domain"
@ -37,7 +40,7 @@ ram.runtime = "50M"
[resources.sources.jitsi-meet-web] [resources.sources.jitsi-meet-web]
url = "https://download.jitsi.org/stable/jitsi-meet-web_1.0.7712-1_all.deb" url = "https://download.jitsi.org/stable/jitsi-meet-web_1.0.7712-1_all.deb"
sha256 = "43917b5d3fd003823933d84beaf822a8a9edaa8f06f897e13b6b575bba3f3c18" sha256 = "43917b5d3fd003823933d84beaf822a8a9edaa8f06f897e13b6b575bba3f3c18"
format = "deb" format = "whatever"
rename = "jitsi-meet-web.deb" rename = "jitsi-meet-web.deb"
[resources.sources.jitsi-sctp] [resources.sources.jitsi-sctp]
@ -47,13 +50,13 @@ ram.runtime = "50M"
[resources.sources.jitsi-jicofo] [resources.sources.jitsi-jicofo]
url = "https://download.jitsi.org/stable/jicofo_1.0-1059-1_all.deb" url = "https://download.jitsi.org/stable/jicofo_1.0-1059-1_all.deb"
sha256 = "365051508e23ff99e3152fd3b414ec695ff920b16da9677a485f85aa91a9d549" sha256 = "365051508e23ff99e3152fd3b414ec695ff920b16da9677a485f85aa91a9d549"
format = "deb" format = "whatever"
rename = "jitsi-jicofo.deb" rename = "jitsi-jicofo.deb"
[resources.sources.jitsi-videobridge] [resources.sources.jitsi-videobridge]
url = "https://download.jitsi.org/stable/jitsi-videobridge2_2.3-64-g719465d1-1_all.deb" url = "https://download.jitsi.org/stable/jitsi-videobridge2_2.3-64-g719465d1-1_all.deb"
sha256 = "cd960148768c846cc97ce37211490f5026a5c4bc81fc48ea2ea22024f83667ca" sha256 = "cd960148768c846cc97ce37211490f5026a5c4bc81fc48ea2ea22024f83667ca"
format = "deb" format = "whatever"
rename = "jitsi-videobridge.deb" rename = "jitsi-videobridge.deb"
[resources.sources.usrsctp] [resources.sources.usrsctp]
@ -63,13 +66,13 @@ ram.runtime = "50M"
[resources.sources.jitsi-meet-prosody] [resources.sources.jitsi-meet-prosody]
url = "https://download.jitsi.org/stable/jitsi-meet-prosody_1.0.7712-1_all.deb" url = "https://download.jitsi.org/stable/jitsi-meet-prosody_1.0.7712-1_all.deb"
sha256 = "30e360d42c4badf07e7269979b8af71eac05d689febc367420e0ca4abecfb16a" sha256 = "30e360d42c4badf07e7269979b8af71eac05d689febc367420e0ca4abecfb16a"
format = "deb" format = "whatever"
rename = "jitsi-meet-prosody.deb" rename = "jitsi-meet-prosody.deb"
[resources.sources.mod_auth_ldap] [resources.sources.mod_auth_ldap]
url = "https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua" url = "https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua"
sha256 = "49c67ec86ec75ac8de93803be2ac7f907d1e9d3d22cd4c88fd48aaeed7a411e3" sha256 = "49c67ec86ec75ac8de93803be2ac7f907d1e9d3d22cd4c88fd48aaeed7a411e3"
format = "lua" format = "whatever"
rename = "mod_auth_ldap.lua" rename = "mod_auth_ldap.lua"
@ -88,9 +91,17 @@ ram.runtime = "50M"
main.url = "/" main.url = "/"
[resources.apt] [resources.apt]
packages = "openjdk-8-jre-headless|openjdk-11-jre-headless|openjdk-17-jre-headless debconf|debconf-2.0 procps uuid-runtime lua-ldap prosody" packages = [
"openjdk-17-jre-headless",
"debconf|debconf-2.0",
"procps",
"uuid-runtime",
"lua-ldap",
"prosody",
]
[[resources.apt.extras]] packages_from_raw_bash = """
repo = "deb http://security.debian.org/debian-security stretch/updates main" if [[ "$YNH_ARCH" == "armhf" ]] || [[ "$YNH_ARCH" == "arm64" ]]; then
key = "https://ftp-master.debian.org/keys/archive-key-9-security.asc" echo automake autoconf build-essential libtool git maven m4
packages = "#FIXME#$pkg_extra_depedencies_arm" fi
"""

View file

@ -4,18 +4,6 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
#REMOVEME? pkg_dependencies="openjdk-8-jre-headless|openjdk-11-jre-headless|openjdk-17-jre-headless debconf|debconf-2.0 procps uuid-runtime lua-ldap"
#REMOVEME? ynh_app_dependencies="prosody"
if [ $YNH_ARCH == "armhf" ]
then
pkg_dependencies_arm="automake autoconf build-essential libtool git maven m4"
#REMOVEME? pkg_dependencies="$pkg_dependencies $pkg_dependencies_arm"
pkg_extra_depedencies_arm="openjdk-8-jre|openjdk-11-jre|openjdk-17-jre openjdk-8-jre-headless|openjdk-11-jre-headless|openjdk-17-jre-headless openjdk-8-jdk|openjdk-11-jdk|openjdk-17-jdk openjdk-8-jdk-headless|openjdk-11-jdk-headless|openjdk-17-jdk-headless"
fi
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

15
tests.toml Normal file
View file

@ -0,0 +1,15 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
test_upgrade_from.f967b101.name = "1.0.4466~ynh1"
test_upgrade_from.ba635a58.name = "1.0.4466~ynh2"
test_upgrade_from.12d4758e.name = "1.0.5913~ynh1"
test_upgrade_from.afbc84d3.name = "1.0.5913~ynh3"
test_upgrade_from.4a043dfd.name = "2.0.8719~ynh2"