1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gotosocial_ynh.git synced 2024-09-03 19:16:06 +02:00
This commit is contained in:
Éric Gaspar 2023-08-15 17:14:40 +02:00
parent e9cd52755e
commit 8736b21351
10 changed files with 366 additions and 729 deletions

View file

@ -1,154 +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=$(jq -j '.version|split("~")[0]' manifest.json)
repo=$(jq -j '.upstream.code|split("https://github.com/")[1]' manifest.json)
# 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"; 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 the retrieved version is not a release candidate
elif [[ "$version" == *"rc"* ]] ; 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.
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download checksums.txt
checksum_file=https://github.com/"$repo"/releases/download/v"$version"/checksums.txt
echo "Downloading checksums file at" "$checksum_file"
curl --silent -4 -L "$checksum_file" -o "$tempdir/checksums.txt"
# 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
*"linux_386"*)
src="i386"
;;
*"linux_amd64"*)
src="x86-64"
;;
*"linux_arm64"*)
src="arm64"
;;
*"linux_armv6"*)
src="armv6"
;;
*"linux_armv7"*)
src="armv7"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ -n "$src" ]; then
# Get checksum
filename=${asset_url##*/}
checksum=$(grep "$filename" "$tempdir/checksums.txt" | awk '{print $1;}')
# 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=$extension
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=$filename
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
# Delete temporary directory
rm -rf "$tempdir"
#=================================================
# 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,50 +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 }}
Changelog: https://github.com/${{ env.REPO }}/releases/tag/v${{ env.VERSION }}
draft: false

View file

@ -1,39 +0,0 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
admin="xana"
email="user@example.com"
password="1Strong-Password"
port="8095"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=0
setup_public=1
upgrade=1
upgrade=1 from_commit=29c7d0df5dd6e3d90070f242b74cce980676cd72
upgrade=1 from_commit=5c1c052995a10d899abcb0e4d4fa1c1dc35f84a5
upgrade=1 from_commit=1b6c1c62e022f04afa02bf128f419e77a72bf1e9
upgrade=1 from_commit=9a6d018337c7d83193282830ff9d9e9b0ae3a733
backup_restore=1
multi_instance=1
port_already_use=1
change_url=0
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=29c7d0df5dd6e3d90070f242b74cce980676cd72
name=0.3.6~ynh1
; commit=5c1c052995a10d899abcb0e4d4fa1c1dc35f84a5
name=v0.4.0~ynh1
; commit=1b6c1c62e022f04afa02bf128f419e77a72bf1e9
name=0.5.2~ynh2
; commit=9a6d018337c7d83193282830ff9d9e9b0ae3a733
name=0.6.0~ynh1

View file

@ -1,13 +1,13 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_pass http://localhost:__PORT__;
client_max_body_size __CLIENT_MAX_BODY_SIZE__; client_max_body_size __CLIENT_MAX_BODY_SIZE__;
# Include SSOWAT user panel. # Include SSOWAT user panel.

View file

@ -70,6 +70,7 @@ type = "select"
################# #################
[main.media] [main.media]
name = "Media config" name = "Media config"
help = "Config pertaining to user media uploads (videos, image, image descriptions)." help = "Config pertaining to user media uploads (videos, image, image descriptions)."
@ -158,6 +159,7 @@ type = "number"
################### ###################
[main.statuses] [main.statuses]
name = "Status config" name = "Status config"
help = "Config pertaining to the creation of statuses/posts, and permitted limits." help = "Config pertaining to the creation of statuses/posts, and permitted limits."

View file

@ -2,6 +2,4 @@ GoToSocial is an [ActivityPub](https://activitypub.rocks/) social network server
With GoToSocial, you can keep in touch with your friends, post, read, and share images and articles. All without being tracked or advertised to! With GoToSocial, you can keep in touch with your friends, post, read, and share images and articles. All without being tracked or advertised to!
![GoToSocial's logo, a stylized sloth head](./doc/logo_sloth.png)
Documentation is at [docs.gotosocial.org](https://docs.gotosocial.org). Documentation is at [docs.gotosocial.org](https://docs.gotosocial.org).

View file

@ -1,7 +1,3 @@
Un serveur de réseau social basé sur [ActivityPub](https://activitypub.rocks/) écrit en Golang. Un serveur de réseau social basé sur [ActivityPub](https://activitypub.rocks/) écrit en Golang.
Avec GoToSocial, vous pouvez rester en contact avec vos amis, publier, lire et partager des images et des articles. Tout cela sans être pisté ni subir de publicité ! Avec GoToSocial, vous pouvez rester en contact avec vos amis, publier, lire et partager des images et des articles. Tout cela sans être pisté ni subir de publicité !
![Le logo de GoToSocial, une tête de paresseux stylisée](./doc/logo_sloth.png)
Vous pouvez consulter la documentation à l'adresse : [docs.gotosocial.org](https://docs.gotosocial.org).

View file

@ -1,117 +0,0 @@
{
"name": "GoToSocial",
"id": "gotosocial",
"packaging_format": 1,
"description": {
"en": "ActivityPub social network server",
"fr": "Serveur de réseau social basé sur ActivityPub"
},
"version": "0.8.1~ynh1",
"url": "https://github.com/superseriousbusiness/gotosocial",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://gotosocial.org/",
"demo": "",
"admindoc": "https://docs.gotosocial.org/en/latest/",
"userdoc": "https://docs.gotosocial.org/en/latest/",
"code": "https://github.com/superseriousbusiness/gotosocial"
},
"license": "AGPL-3.0-only",
"maintainer": {
"name": "OniriCorpe",
"email": ""
},
"requirements": {
"yunohost": ">= 11.0.6"
},
"multi_instance": true,
"services": [
"nginx",
"postgresql"
],
"arguments": {
"install": [
{
"name": "alpha_software",
"type": "alert",
"ask": {
"en": "⚠️ Please note that GoToSocial is in early development stage. It may contain changing or unstable features, bugs, and security vulnerability.",
"fr": "⚠️ Veuillez noter que GoToSocial est au début de son développment. Il pourrait contenir des fonctionnalités changeantes ou instables, des bugs, et des failles de sécurité."
}
},
{
"name": "domain",
"type": "domain"
},
{
"name": "admin",
"type": "string",
"ask": {
"en": "The username of your admin account.",
"fr": "Le nom d'utilisateur de votre compte admin."
},
"help": {
"en": "Must be in lower case and without special characters.",
"fr": "Doit être en minuscule et sans caractère special."
},
"example": "johndoe"
},
{
"name": "email",
"type": "string",
"ask": {
"en": "The email adress of your admin account.",
"fr": "L'adresse e-mail de votre compte admin."
},
"example": "johndoe@example.com"
},
{
"name": "password",
"type": "password",
"help": {
"en": "Must contain: upper case, lower case, number and special character.",
"fr": "Il doit contenir : majuscule, minuscule, chiffre et caractère spécial."
}
},
{
"name": "accounts_registration_open",
"type": "boolean",
"ask": {
"en": "Open registration?",
"fr": "Inscriptions ouvertes ?"
},
"help": {
"en": "Do you want people to be able to just submit sign up requests (true), or do you want invite only (false)?",
"fr": "Voulez-vous que les gens puissent envoyer des demandes d'inscription (true) ou voulez-vous que les inscriptions soient uniquement sur invitation (false) ?"
},
"default": false
},
{
"name": "accounts_approval_required",
"type": "boolean",
"ask": {
"en": "Registration approval?",
"fr": "Vérification manuelle des inscriptions ?"
},
"help": {
"en": "Do sign up requests require approval from an admin/moderator before an account can sign in/use the server?",
"fr": "Les demandes d'inscription doivent-elles être approuvées par un-e administrateur-ice/modérateur-ice avant qu'un compte puisse se connecter et utiliser le serveur ?"
},
"default": true
},
{
"name": "accounts_reason_required",
"type": "boolean",
"ask": {
"en": "Request registration reason?",
"fr": "Demande de motif pour les inscriptions ?"
},
"help": {
"en": "Are sign up requests required to submit a reason for the request (eg., an explanation of why they want to join the instance)?",
"fr": "Les demandes d'inscription doivent-elles être accompagnée d'un motif (par exemple, une explication de la raison pour laquelle la personne veut rejoindre l'instance) ?"
},
"default": true
}
]
}
}

View file

@ -1,7 +1,7 @@
packaging_format = 2 packaging_format = 2
description.en = "An ActivityPub social network server, written in Golang." description.en = "ActivityPub social network server"
description.fr = "Un serveur de réseau social basé sur ActivityPub écrit en Golang." description.fr = "Serveur de réseau social basé sur ActivityPub"
id = "gotosocial" id = "gotosocial"
name = "GoToSocial" name = "GoToSocial"
@ -12,13 +12,13 @@ maintainers = ["OniriCorpe"]
[upstream] [upstream]
admindoc = "https://docs.gotosocial.org/en/latest/" admindoc = "https://docs.gotosocial.org/en/latest/"
code = "https://github.com/superseriousbusiness/gotosocial" code = "https://github.com/superseriousbusiness/gotosocial"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "https://github.com/superseriousbusiness/gotosocial#sponsorship--funding" fund = "https://github.com/superseriousbusiness/gotosocial#sponsorship--funding"
license = "AGPL-3.0-only" license = "AGPL-3.0-only"
userdoc = "https://docs.gotosocial.org/en/latest/" userdoc = "https://docs.gotosocial.org/en/latest/"
website = "https://docs.gotosocial.org/" website = "https://docs.gotosocial.org/"
[integration] [integration]
yunohost = ">= 11.2"
architectures = [ architectures = [
"amd64", "amd64",
"i386", "i386",
@ -32,9 +32,9 @@ multi_instance = true
ram.build = "50M" ram.build = "50M"
ram.runtime = "200M" ram.runtime = "200M"
sso = false sso = false
yunohost = ">= 11.1.6"
[install] [install]
[install.alpha_software] [install.alpha_software]
ask.en = "Please note that GoToSocial is in early development stage. It may contain changing or unstable features, bugs, and security vulnerability." ask.en = "Please note that GoToSocial is in early development stage. It may contain changing or unstable features, bugs, and security vulnerability."
ask.fr = "Veuillez noter que GoToSocial est au tout début de son développment. Il pourrait contenir des fonctionnalités changeantes ou instables, des bugs, et des failles de sécurité." ask.fr = "Veuillez noter que GoToSocial est au tout début de son développment. Il pourrait contenir des fonctionnalités changeantes ou instables, des bugs, et des failles de sécurité."
@ -86,6 +86,7 @@ help.fr = "Les demandes d'inscription doivent-elles être accompagnée d'un moti
type = "boolean" type = "boolean"
[resources] [resources]
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]

0
tests.toml Normal file
View file