From 545183c8aec92ed09d0dc4f16af986771edb3d42 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 28 Sep 2021 23:47:59 +0200 Subject: [PATCH 01/13] Upgrade to v4.16.0 --- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/install | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/app.src b/conf/app.src index 12fd405..01ef1dc 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Ghost/releases/download/v4.9.4/Ghost-4.9.4.zip -SOURCE_SUM=90f48a1554430c13e57caece5aaef145dd3c7e6aedf9e72a1e12987a938692bc +SOURCE_URL=https://github.com/TryGhost/Ghost/releases/download/v4.16.0/Ghost-4.16.0.zip +SOURCE_SUM=DE7041DA31362BB8DF1043864A94026D6B692EBCEF8FEBD886F635BEF8E3DA84 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 97191c7..869961f 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Just a blogging platform", "fr": "Plateforme de blogging" }, - "version": "4.9.4~ynh1", + "version": "4.16.0~ynh1", "url": "https://ghost.org/", "upstream": { "license": "MIT", diff --git a/scripts/install b/scripts/install index c8ee86f..f86ee2a 100644 --- a/scripts/install +++ b/scripts/install @@ -210,5 +210,5 @@ ynh_send_readme_to_admin "$message" #================================================= # END OF SCRIPT #================================================= - + ynh_script_progression --message="Installation of $app completed" From 79300b2db7ad4feb1a8081315265c6b5d60bcb73 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot Date: Tue, 28 Sep 2021 21:56:59 +0000 Subject: [PATCH 02/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 43e89c6..e69e926 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Just a blogging platform -**Shipped version:** 4.9.4~ynh1 +**Shipped version:** 4.16.0~ynh1 diff --git a/README_fr.md b/README_fr.md index 78e9c7c..bceeedb 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Plateforme de blogging -**Version incluse :** 4.9.4~ynh1 +**Version incluse :** 4.16.0~ynh1 From 7c81603e260f5bda84dd5d2e32baa0a0c4e00724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 29 Sep 2021 09:27:49 +0200 Subject: [PATCH 03/13] Update admin.src (#52) --- conf/admin.src | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/conf/admin.src b/conf/admin.src index 3bdb91c..d7ba541 100644 --- a/conf/admin.src +++ b/conf/admin.src @@ -1,7 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v4.7.0.zip -SOURCE_SUM=0bd18e13e138b015561609d7b19ddd8623c22c86bf19c6ada3a4267b8c5dbe1c +SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v4.16.0.zip +SOURCE_SUM=91b674c26838bd55a57a3cbc0cfbf873e6aa5dec625bc1245405d653f3410c99 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= - From 6399c3b748dcee3c6244441b3116fd308d82f1ff Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 28 Sep 2021 23:53:44 +0200 Subject: [PATCH 04/13] Create updater.yml --- .github/workflows/updater.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..ca77fed --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,48 @@ +# 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 ' + author: 'yunohost-bot ' + signoff: false + branch: ci-auto-update-v${{ env.VERSION }} + delete-branch: true + title: 'Upgrade to version ${{ env.VERSION }}' + body: | + Upgrade to v${{ env.VERSION }} + draft: false From e6c351dc8fb51814d11748104fda38a012f4170d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 00:02:34 +0200 Subject: [PATCH 05/13] Create updater.sh --- .github/workflows/updater.sh | 130 +++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 .github/workflows/updater.sh diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..9604311 --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,130 @@ +#!/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 ) | .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. + +# 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 + "Ghost-"*".zip") + 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.gz ]]; then + extension=tar.gz +else + extension=${filename##*.} +fi + +# Rewrite source file +cat < conf/$src.src +SOURCE_URL=$asset_url +SOURCE_SUM=$checksum +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=$extension +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= +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 + From e92047154e790e33a4e52c1d74fecb73db84270e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 00:11:05 +0200 Subject: [PATCH 06/13] Add check on number of processed assets in updater.sh --- .github/workflows/updater.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 9604311..f2120d1 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -53,6 +53,8 @@ echo "${#assets[@]} available asset(s)" # Here we use the $assets variable to get the resources published in the upstream release. +count=0 + # Let's loop over the array of assets URLs for asset_url in ${assets[@]}; do @@ -102,12 +104,19 @@ SOURCE_FILENAME= EOT echo "... conf/$src.src updated" +count=$((count+1)) + else echo "... asset ignored" fi done +if [ $count == 0 ]; then + echo "::warning ::None of the assets were processed." + exit 0 +fi + #================================================= # SPECIFIC UPDATE STEPS #================================================= From e8cc71544a80c60c750a15d438a7fe353057ee39 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 00:12:09 +0200 Subject: [PATCH 07/13] Fix updater.sh --- .github/workflows/updater.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index f2120d1..10b7b53 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -64,7 +64,7 @@ echo "Handling asset at $asset_url" # 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 - "Ghost-"*".zip") + *"Ghost-"*".zip") src="app" ;; *) From 47fdc0197fbcdfce0dab4b51f169b014599b07c3 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 00:14:29 +0200 Subject: [PATCH 08/13] Update updater.yml --- .github/workflows/updater.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index ca77fed..fd6ed60 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -41,6 +41,7 @@ jobs: author: 'yunohost-bot ' signoff: false branch: ci-auto-update-v${{ env.VERSION }} + base: testing delete-branch: true title: 'Upgrade to version ${{ env.VERSION }}' body: | From 59464536f0333775da1d318bffcab36598329685 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 08:27:26 +0200 Subject: [PATCH 09/13] Download admin too in updater.sh --- .github/workflows/updater.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 10b7b53..e6951e8 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -20,9 +20,12 @@ repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[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 "'")) +admin_repo="TryGhost/Admin" +assets+=("https://api.github.com/repos/TryGhost/Admin/zipball/$version") + # 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. +# 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 @@ -67,6 +70,9 @@ case $asset_url in *"Ghost-"*".zip") src="app" ;; + *"/Admin/"*) + src="admin" + ;; *) src="" ;; @@ -100,7 +106,6 @@ SOURCE_SUM=$checksum SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=$extension SOURCE_IN_SUBDIR=false -SOURCE_FILENAME= EOT echo "... conf/$src.src updated" From aeb2b8eefd75b389dd79f151f9242ff6ba423d25 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 00:21:34 +0200 Subject: [PATCH 10/13] Silence all build warnings --- scripts/install | 12 ++++++------ scripts/upgrade | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index f86ee2a..6862964 100644 --- a/scripts/install +++ b/scripts/install @@ -129,12 +129,12 @@ ynh_script_progression --message="Building $app... (this will take some time and pushd "$final_path" || ynh_die ynh_use_nodejs - yarn install --non-interactive --silent - yarn global add knex-migrator - NODE_ENV=production knex-migrator init - yarn global add grunt-cli ember-cli - NODE_ENV=production grunt symlink - NODE_ENV=production grunt init --force + ynh_exec_warn_less yarn install --non-interactive --silent + ynh_exec_warn_less yarn global add knex-migrator + ynh_exec_warn_less NODE_ENV=production knex-migrator init + ynh_exec_warn_less yarn global add grunt-cli ember-cli + ynh_exec_warn_less NODE_ENV=production grunt symlink + ynh_exec_warn_less NODE_ENV=production grunt init --force popd || ynh_die diff --git a/scripts/upgrade b/scripts/upgrade index cf364d6..a2af1bc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -156,12 +156,12 @@ then ynh_script_progression --message="Building $app... (this will take some time and resources!)" pushd "$final_path" || ynh_die - yarn install - yarn global add knex-migrator - NODE_ENV=production knex-migrator init - yarn global add grunt - NODE_ENV=production grunt symlink - NODE_ENV=production grunt init --force + ynh_exec_warn_less yarn install + ynh_exec_warn_less yarn global add knex-migrator + ynh_exec_warn_less NODE_ENV=production knex-migrator init + ynh_exec_warn_less yarn global add grunt + ynh_exec_warn_less NODE_ENV=production grunt symlink + ynh_exec_warn_less NODE_ENV=production grunt init --force popd || ynh_die fi From 2eca17babb20eb259ffd069bcc07065d9da88004 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 08:03:36 +0200 Subject: [PATCH 11/13] Remove superfluous example in manifest --- manifest.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 869961f..131821b 100644 --- a/manifest.json +++ b/manifest.json @@ -31,12 +31,11 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "domain.org" + "type": "domain" }, { "name": "path", - "type": "path", + "type": "path", "example": "/blog", "default": "/blog" }, From c307a6e097fe4a70de42ff4cb1d49aed91b66159 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 08:04:40 +0200 Subject: [PATCH 12/13] Remove ynh_webpath_available in restore --- scripts/restore | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 68709ce..405d5e9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -39,8 +39,6 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= ynh_script_progression --message="Validating restoration parameters..." -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " From 1f3c4d3bc31b9cbf67c71a8b4cb599eaf3c4290e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 29 Sep 2021 10:24:04 +0200 Subject: [PATCH 13/13] Update check_process --- check_process | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check_process b/check_process index 8f8fa27..70c1485 100644 --- a/check_process +++ b/check_process @@ -13,6 +13,8 @@ upgrade=1 # 4.3.3 upgrade=1 from_commit=198004df76b0b3ef22a6dfe1b9a2738af62f0786 + # 4.9.4 + upgrade=1 from_commit=7a150ab29ee969f72dd7846539ae12ac1975165b backup_restore=1 multi_instance=1 change_url=0 @@ -22,3 +24,5 @@ Notification=none ;;; Upgrade options ; commit=198004df76b0b3ef22a6dfe1b9a2738af62f0786 name=4.3.3 + ; commit=7a150ab29ee969f72dd7846539ae12ac1975165b + name=4.9.4