From 010965a07b4cd3d58fec2d1ed1addbe2c2526348 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 6 Mar 2022 23:28:18 +0000 Subject: [PATCH] Update bash scripts Former-commit-id: 0128dcfee587fdadf7866e2360bf05a20233e5e6 [formerly 8d52eddf4e72893b00be5a14a2b569f251ac6dc3] [formerly 2c5adacd345cfe6fe86198867605775c9df51b90] [formerly 05c61d02ee4d888e0aa0b34b6a0ff9047ddff2a3 [formerly 5f4ee9a6a138fb13a9efa7071714e3c118aadae4 [formerly ab0650377fe49a5f94c89448e7eb4244e79c8ae6]]] Former-commit-id: 432955a35d482c9ddcbcbbea008bc5185cdc58e7 [formerly b1c8c9fb550fdcac069f6163e2d4017187f5e6ed [formerly 2f418171af44391b41cff2106d47309a6f91ff58]] Former-commit-id: aa000be52738a4dd989dfd05ffbd5b3e69bfa32a [formerly 24c437d62fbd2d92f688d0119ea7a79c6dbac354] Former-commit-id: 8af81625deb191e21faba01edc76c4bd4cbec65f --- scripts/publish_linux_packages_to_kiwix.sh | 12 ++++++++---- scripts/rewrite_app_version_number.sh | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/publish_linux_packages_to_kiwix.sh b/scripts/publish_linux_packages_to_kiwix.sh index ef4e7830..2bf0df42 100644 --- a/scripts/publish_linux_packages_to_kiwix.sh +++ b/scripts/publish_linux_packages_to_kiwix.sh @@ -1,12 +1,16 @@ #!/bin/bash - # Script to upload Linux packages to download.kiwix.org target="/data/download/release/kiwix-js-electron" -echo "Uploading the files to https://download.kiwix.org/$target/" -echo "ssh -o StrictHostKeyChecking=no -i ./scripts/ssh_key ci@download.kiwix.org mkdir -p $target" +if [[ "qq${CRON_LAUNCHED}" != "qq" ]]; then + echo "This script was launched by the GitHub Cron proces" + CURRENT_DATE=$(date +'%Y-%m-%d') + target="/data/download/nightly/$CURRENT_DATE" +fi +echo "Uploading packages to https://download.kiwix.org/$target/" +ssh -o StrictHostKeyChecking=no -i ./scripts/ssh_key ci@download.kiwix.org mkdir -p $target for file in ./bld/Electron/* ; do if [[ $file =~ \.(AppImage|deb|rpm)$ ]]; then - echo "scp -r -p -o StrictHostKeyChecking=no -i $file ci@download.kiwix.org:$target" + scp -o StrictHostKeyChecking=no -i $file ci@download.kiwix.org:$target echo "Copied $file to $target" fi done \ No newline at end of file diff --git a/scripts/rewrite_app_version_number.sh b/scripts/rewrite_app_version_number.sh index e531c261..96a4d250 100644 --- a/scripts/rewrite_app_version_number.sh +++ b/scripts/rewrite_app_version_number.sh @@ -13,10 +13,11 @@ VERSION=${INPUT_VERSION} # If the script was launched by Cron, then there will be no INPUT_VERSION, so construct a nightly version number if [[ "qq${CRON_LAUNCHED}" != "qq" ]]; then + echo "This script was launched by the GitHub Cron job" COMMIT_ID=$(git rev-parse --short HEAD) # Get version from init.js VERSION="$(grep 'params\[.appVersion' www/js/init.js | sed -E "s/[^[:digit:]]+([^\"']+).*/\1/")" - VERSION="v$VERSION$COMMIT_ID" + VERSION="v$VERSION-$COMMIT_ID" fi if [[ $VERSION =~ ^v?[0-9.]+ ]]; then VERSION=$(sed 's/^v//' <<<"$VERSION") # Remove any leading v