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

Fix all the things

This commit is contained in:
tituspijean 2022-07-07 22:45:43 +02:00
parent 8bc308d7d3
commit 9cef9cfc22
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
7 changed files with 39 additions and 12 deletions

View file

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

View file

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

View file

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

5
conf/casper.src Normal file
View file

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

View file

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

View file

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

View file

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