From 9cef9cfc2250307a55feee14120b51105657e9cb Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 7 Jul 2022 22:45:43 +0200 Subject: [PATCH] Fix all the things --- .github/workflows/updater.sh | 22 +++++++++++++++++----- conf/admin.src | 6 +++--- conf/app.src | 6 +++--- conf/casper.src | 5 +++++ manifest.json | 2 +- scripts/install | 5 +++++ scripts/upgrade | 5 +++++ 7 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 conf/casper.src diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 9f1ee63..a5b6d11 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -14,14 +14,24 @@ #================================================= # 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) + +current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') + +# CORE +# repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') +repo="TryGhost/Ghost" 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'").zipball_url ] | join(" ") | @sh' | tr -d "'")) +# ADMIN admin_repo="TryGhost/Admin" -assets+=("https://github.com/TryGhost/Admin/archive/refs/tags/${version}.zip") +assets+=("https://github.com/$admin_repo/archive/refs/tags/${version}.zip") + +# THEME +theme_repo="TryGhost/Casper" +theme_version=$(curl --silent "https://api.github.com/repos/$theme_repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) +assets+=("https://github.com/$theme_repo/archive/refs/tags/${version}.zip") # 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. @@ -73,6 +83,9 @@ case $asset_url in *"/Admin/"*) src="admin" ;; + *"/Casper/"*) + src="casper" + ;; *) src="" ;; @@ -98,7 +111,7 @@ SOURCE_URL=$asset_url SOURCE_SUM=$checksum SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true EOT echo "... conf/$src.src updated" @@ -134,4 +147,3 @@ echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > # The Action will proceed only if the PROCEED environment variable is set to true echo "PROCEED=true" >> $GITHUB_ENV exit 0 - diff --git a/conf/admin.src b/conf/admin.src index e34aa75..bd1b4db 100644 --- a/conf/admin.src +++ b/conf/admin.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.2.2.zip -SOURCE_SUM=20f1aea329107ad1ef9c128b6727a73316a2ff3dfdf5f143735506d6a988d249 +SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.2.4.zip +SOURCE_SUM=b23d9d053fc30897f1851170a675c4d01fc615f409262f94d1bc85cfd5932605 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true diff --git a/conf/app.src b/conf/app.src index dd1c80e..2b99bd0 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.2.2 -SOURCE_SUM=0a4841756dde09dfd43e79180d6f59e159ae4c681ef7a89d8f5769b8ce944aa3 +SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.2.4 +SOURCE_SUM=04ba64fd6f7ecb0ba0970eb63189b5b5780095260bce5d4edd2b50e25d0a316b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true diff --git a/conf/casper.src b/conf/casper.src new file mode 100644 index 0000000..2be34af --- /dev/null +++ b/conf/casper.src @@ -0,0 +1,5 @@ +SOURCE_URL=https://github.com/TryGhost/Casper/archive/refs/tags/v5.2.4.zip +SOURCE_SUM=d5558cd419c8d46bdc958064cb97f963d1ea793866414c025906ec15033512ed +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index ec6a20e..3b22f98 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Publishing, memberships, subscriptions and newsletters platform", "fr": "Plateforme d'édition, d'adhésions, d'abonnements et de newsletters" }, - "version": "5.2.2~ynh1", + "version": "5.2.4~ynh1", "url": "https://ghost.org/", "upstream": { "license": "MIT", diff --git a/scripts/install b/scripts/install index 0f7fd56..f628627 100644 --- a/scripts/install +++ b/scripts/install @@ -103,6 +103,10 @@ ynh_setup_source --dest_dir="$final_path" mkdir -p $final_path/core/client/Admin ynh_setup_source --dest_dir="$final_path/core/client/Admin" --source_id="admin" +# Download, check integrity, uncompress and patch the source from casper.src +mkdir -p $final_path/content/themes/casper +ynh_setup_source --dest_dir="$final_path/content/themes/casper" --source_id="casper" + chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -134,6 +138,7 @@ ynh_script_progression --message="Building Ghost... (this will take some time an pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/knex-migrator init ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt symlink ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt init --force diff --git a/scripts/upgrade b/scripts/upgrade index 304bc31..e7f8598 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,6 +107,10 @@ then mkdir -p $final_path/core/client/Admin ynh_setup_source --dest_dir="$final_path/core/client/Admin" --source_id="admin" + # Download, check integrity, uncompress and patch the source from casper.src + mkdir -p $final_path/content/themes/casper + ynh_setup_source --dest_dir="$final_path/content/themes/casper" --source_id="casper" + # Copy the admin saved settings from tmp directory to final path cp -ar "$tmpdir/config.production.json" "$final_path/config.production.json" @@ -163,6 +167,7 @@ then pushd "$final_path" ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/knex-migrator init ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt symlink ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt init --force