mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 03:37:12 -04:00

Former-commit-id: f618a3b03e45ebebec987f9c89907dae4b2858fb [formerly d925239aa282080fd1d2a19df7b1de02fd74f581] [formerly 779b9ad3acb6f8cfc94b8c2e89d254539716cc06] [formerly c7d2aa5c5497fca4b45d3d597d7c7b7b9e3bea84 [formerly f079ed91ce661cdff071990fc2344721ed962c04 [formerly 1403e9605cb1a82858c6eaa8e85c89d24730a638]]] Former-commit-id: 6c45493bc072a30d4af7730555f637735ed1bc22 [formerly f9f2308419542565aec7de1b1847bb7c6b038269 [formerly 9390d560094fa28f091a691fdedc38b6f779c965]] Former-commit-id: ad1965df908f84082721abec9e4684d23a52d237 [formerly d843a400b4f20385cea7ce5906f4b4bb2f78862d] Former-commit-id: a171829fc91b8ffaa73462b32830859ae910c650
43 lines
1.9 KiB
Bash
43 lines
1.9 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")
|
|
# Convert spaces and hyphens to underscores
|
|
filename=$(sed -E 's/[\s-]/_/g' <<<"$filename")
|
|
# Remove unneeded elements
|
|
filename=$(sed -E 's/_E([_.])/\1/' <<<"$filename")
|
|
# Convert to all lowercase
|
|
filename="${filename,,}"
|
|
# Restore hyphens in app name and architecture
|
|
filename=$(sed 'kiwix_js_electron/kiwix-js-electron/' <<<"$filename")
|
|
filename=$(sed 'x86_64/x86-64/' <<<"$filename")
|
|
# Normalize 64bit naming convention
|
|
filenamee=$(sed 's/amd64/x86-64/' <<<"filename")
|
|
# Remove spurious dot
|
|
filenamee=$(sed -E 's/\.(i686|x86)/_\1/' <<<"$filename")
|
|
# Swap order of architecture and release number
|
|
filenamee=$(sed -E 's/(electron)(.+)(_(i[36]86|x86)[^.]*)/\1\3\2/' <<<"$filename")
|
|
# Delete release number other than SHA
|
|
filenamee=$(sed -E 's/_[0-9.]+([-_.])/\1/' <<<"$filename")
|
|
# Put it all together
|
|
renamed_file="$directory$filename"
|
|
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 |