-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #391 from YunoHost-Apps/testing"
- Loading branch information
1 parent
2114cc9
commit d5d2f8b
Showing
32 changed files
with
1,457 additions
and
424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#!/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=$(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 ) | .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" >> $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 | ||
*".tar.xz") | ||
src="app" | ||
;; | ||
*) | ||
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.xz ]]; then | ||
extension=tar.xz | ||
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_IN_SUBDIR=true | ||
SOURCE_EXTRACT=true | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 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 '[email protected]' | ||
# 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 <[email protected]>' | ||
author: 'yunohost-bot <[email protected]>' | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
;; Test complet | ||
; Manifest | ||
domain="domain.tld" | ||
is_public=1 | ||
admin="john" | ||
; Checks | ||
pkg_linter=1 | ||
setup_sub_dir=0 | ||
setup_root=1 | ||
setup_nourl=0 | ||
setup_private=1 | ||
setup_public=1 | ||
upgrade=1 | ||
# 3.2.1~ynh1 | ||
# upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf | ||
# 3.2.1~ynh3 | ||
#upgrade=1 from_commit=7a621c48f6bdd10334f2d0c06f787fe468788f62 | ||
# 3.2.1~ynh4 | ||
upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44 | ||
# 3.3.0~ynh1 | ||
#upgrade=1 from_commit=c43548f6e0a0e5d172360945f6941255537ec18c | ||
# 3.3.0~ynh2 | ||
#upgrade=1 from_commit=6010986d58ef0caa8428e3d6e3ff3fd512401a53 | ||
# 3.3.0~ynh2 | ||
#upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651 | ||
# 3.3.0~ynh3 | ||
#upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0 | ||
# 3.3.0~ynh4 | ||
#upgrade=1 from_commit=509ba9051facf65329dde20919a3254dcaf3f910 | ||
# 3.4.0~ynh1 | ||
#upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79 | ||
# 3.4.1~ynh1 | ||
#upgrade=1 from_commit=96f010a9f72fed48660b3f962124b553397b283b | ||
# 3.4.1~ynh2 | ||
#upgrade=1 from_commit=0b6823def8230b3af7f9b484c526a49c3a640c4d | ||
# 3.4.1~ynh3 | ||
upgrade=1 from_commit=0f77bb6e7441698b762bde38698c510dc0a4438e | ||
# 4.0.0~ynh1 | ||
#upgrade=1 from_commit=602bf56af8582a38c7ee055f60e782e2da0efddc | ||
# 4.0.0~ynh1 | ||
#upgrade=1 from_commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c | ||
# 4.0.0~ynh1 | ||
#upgrade=1 from_commit=9bdfda10d83519064adeb275f6aed1660bf24b88 | ||
# 4.0.0~ynh2 | ||
#upgrade=1 from_commit=16bc11e945c2b1a962a5deace7c0f27b8d5a5112 | ||
# 4.0.0~ynh2 | ||
#upgrade=1 from_commit=6995b27972e27c6cf8ee3e1f23a2de5cc8c8e8ee | ||
# 4.1.0~ynh1 | ||
#upgrade=1 from_commit=d5aa8c2194297b332d26e68b5e9e8ada17377742 | ||
# 4.1.1~ynh1 | ||
#upgrade=1 from_commit=24c8333d70312e9dcf8d278e64787ca561a10b2e | ||
# 4.2.0~ynh1 | ||
#upgrade=1 from_commit=ddb937ecab9454e8dd0b07627a02bad27c9f6556 | ||
# 4.2.1~ynh1 | ||
#upgrade=1 from_commit=5a488aebc53dafa5c431580ca4437eed0ad7da1e | ||
# 4.2.2~ynh1 | ||
upgrade=1 from_commit=9bf92ff65db0dcb188834738f180dbfa34ebef09 | ||
# 5.2.0~ynh1 | ||
upgrade=1 from_commit=fbf90aa8845edfb8bc1f75e335ea706203fe77e7 | ||
backup_restore=1 | ||
multi_instance=0 | ||
port_already_use=0 | ||
change_url=0 | ||
;;; Options | ||
Email= | ||
Notification=none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v5.2.1/peertube-v5.2.1.tar.xz | ||
SOURCE_SUM=27d577ab63d29be865934088d1831373a71433c78443a4441fb3ac416995817c | ||
SOURCE_SUM_PRG=sha256sum | ||
SOURCE_FORMAT=tar.xz | ||
SOURCE_IN_SUBDIR=true | ||
SOURCE_EXTRACT=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
__APP__ was successfully installed :) | ||
|
||
Please open your __APP__ domain: https://__DOMAIN____PATH_URL__ | ||
|
||
The admin username is: root | ||
The admin password is: __ADMIN_PASS__ | ||
|
||
To make PeerTube Live available, you also need to make the TCP port __RTMP_PORT__ available from internet (For example, opening the port on your ISP box if it's not automatically done). | ||
|
||
To enable LDAP authentication open https://__DOMAIN____PATH_URL__admin/plugins/show/peertube-plugin-auth-ldap | ||
Complete with the following informations : | ||
- URL: ldap://127.0.0.1 | ||
- Insecure TLS : checked | ||
- Search base : ou=users,dc=yunohost,dc=org | ||
All YunoHost users will be allowed to login as peertube user. | ||
|
||
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
__APP__ was successfully removed :) | ||
|
||
The domain https://__DOMAIN____PATH_URL__ is free for other apps to be installed on it. | ||
|
||
You should close the PeerTube Live TCP port __RTMP_PORT__ available from internet (For example, closing the port on your ISP box if it's not automatically done). | ||
|
||
But a futher action is required from your side to completely remove the __APP__ data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND. | ||
And if you are going to migrate to othe server you will have to move __DATADIR__ to your new server. | ||
|
||
|
||
You need to run this command to remove the data (warning all your videos will be removed): | ||
|
||
rm -R __DATADIR__ -f | ||
|
||
If you facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh |
Oops, something went wrong.