kiwix-js-pwa/scripts/publish_linux_packages_to_kiwix.sh
Jaifroid 5455bf6fe4 Ensure uppercase channel
Former-commit-id: ff37d200c0ca71cca09b60b0e97c8af5561697a3 [formerly a6c86d32935a71ea87c735db1d8a30a85bf453df] [formerly 1a2facf153a9185f2ad4db07aba7ca566285509c] [formerly a7e892cfe4d157e609170bef58058de7476976a6 [formerly 896891a43e49e1049eb4f733b1bd8d1d82d37a9c [formerly 73a6f41cd8434b15a8cec80dc194f36f95a35c3a]]]
Former-commit-id: 51cc06eca6dc0dd852a6e4017fffb52d6a096580 [formerly f015909fc0f37b47152b8142ab98a064f2585b96 [formerly 51a6039a5bff58c16620e767eb03d9442871d494]]
Former-commit-id: 0533522965f19452b1fb135effa7bc7e66aa6e46 [formerly 309eabcdbe8a7cf5cafd2f4ecd06e53366a8d1b3]
Former-commit-id: 32eb435d52f7058fa0014f9163d5832a9d9f1702
2022-03-14 06:40:49 +00:00

30 lines
1.2 KiB
Bash

#!/bin/bash
# Script to upload Linux packages to download.kiwix.org
target="/data/download/release/kiwix-js-electron"
if [[ ${INPUT_TARGET} = "nightly" ]]; then
CRON_LAUNCHED="1"
fi
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
directory=$(sed -E 's/[^\/]+$//' <<<"$file")
filename=$(sed -E 's/[^/]+\///g' <<<"$file")
filename=$(sed 's/\s/-/g' <<<"$filename")
filename=$(sed 's/_/-/g' <<<"$filename")
# Convert to all lowercase
filename="${filename,,}"
renamed_file="$directory$filename"
renamed_file=$(sed 's/-e-/-E-/' <<<"$renamed_file")
if [[ "$file" != "$renamed_file" ]]; then
mv "$file" "$renamed_file"
fi
scp -o StrictHostKeyChecking=no -i ./scripts/ssh_key "$renamed_file" ci@download.kiwix.org:$target
echo "Copied $renamed_file to $target"
fi
done