TeaWeb/scripts/deploy_ui_files.sh

73 lines
2.0 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Example usage: ./scripts/deploy_ui_files.sh http://dev.clientapi.teaspeak.de/api.php test 1.1.0
2018-11-19 18:05:42 +00:00
2021-03-22 16:17:34 +00:00
cd "$(dirname "$0")" || { echo "failed to enter base directory"; exit 1; }
source "./helper.sh"
Implemented the Material Design and fixed some bugs (#33) * cleaned up some files * Fundamental style update * Redesigned some style * fixed hostbanner popup * Removed old identity stuff * fixed close listener * Fixed changelog date * fixed release chat icons * fixed url * Fixed hostbanner * Uploaded missing images * Improved update handling * Improved script files * Fixed loading error and icon error * fixed Yes/No modal * Fixed loader issues with MS Edge * fixed modal style bug * Fixed control bar overflow for small devices * Improved error handling on identity creation * Logging generate error to terminal * fixed possible php error * fixed some possible loading errors when other files have'nt been already loaded. * removed debug message * Changed emsrcypten flags * Improved codec error handling * removed webassembly as required dependency * Improved and fixed channel tree issues * Improved the sliders * Removed unneeded files * fixed loader versions cache * second slight performance improved (dont animate elements anymore if they are not shown) * Fixed query visibility setting * not showing useless client infos for query clients * Added an auto reconnect system * Added a canceled message and increased reconnect interval * removed implemented todo * fixed repetitive channel names * Reworked the channel tree selected lines * Fixed channel tree names * Fixed name alignment * fixed the native client * added min width to the server select groups to avoid a disappearing effect on shrink * fixed bugged downloaded icons
2019-02-17 15:08:10 +00:00
if [[ "$#" -ne 3 ]]; then
2018-11-19 18:05:42 +00:00
echo "Illegal number of parameters (url | channel | required version)"
exit 1
fi
# shellcheck disable=SC2154
Implemented the Material Design and fixed some bugs (#33) * cleaned up some files * Fundamental style update * Redesigned some style * fixed hostbanner popup * Removed old identity stuff * fixed close listener * Fixed changelog date * fixed release chat icons * fixed url * Fixed hostbanner * Uploaded missing images * Improved update handling * Improved script files * Fixed loading error and icon error * fixed Yes/No modal * Fixed loader issues with MS Edge * fixed modal style bug * Fixed control bar overflow for small devices * Improved error handling on identity creation * Logging generate error to terminal * fixed possible php error * fixed some possible loading errors when other files have'nt been already loaded. * removed debug message * Changed emsrcypten flags * Improved codec error handling * removed webassembly as required dependency * Improved and fixed channel tree issues * Improved the sliders * Removed unneeded files * fixed loader versions cache * second slight performance improved (dont animate elements anymore if they are not shown) * Fixed query visibility setting * not showing useless client infos for query clients * Added an auto reconnect system * Added a canceled message and increased reconnect interval * removed implemented todo * fixed repetitive channel names * Reworked the channel tree selected lines * Fixed channel tree names * Fixed name alignment * fixed the native client * added min width to the server select groups to avoid a disappearing effect on shrink * fixed bugged downloaded icons
2019-02-17 15:08:10 +00:00
if [[ "${teaclient_deploy_secret}" == "" ]]; then
echo "Missing deploy secret!"
exit 1
fi
2021-03-22 16:17:34 +00:00
package_file=$(find_release_package "client" "release")
if [[ $? -ne 0 ]]; then
echo "$package_file"
exit 1
fi
2021-03-22 16:51:53 +00:00
# We require a .tar.gz file and not a zip file.
# So we're extracting the contents and tar.gz ing them
temp_dir=$(mktemp -d)
unzip "$package_file" -d "$temp_dir/raw/"
if [[ $? -ne 0 ]]; then
rm -r "$temp_dir" &>/dev/null
echo "Failed to unpack package."
2021-03-22 18:13:04 +00:00
exit 1
2021-03-22 16:51:53 +00:00
fi
echo "Generating .tar.gz file from $package_file"
package_file="$temp_dir/$(basename -s ".zip" "$package_file").tar.gz"
2021-03-22 18:13:04 +00:00
tar --use-compress-program="gzip -9" -C "$temp_dir/raw/" -c . -cf "$package_file";
2021-03-22 16:51:53 +00:00
if [[ $? -ne 0 ]]; then
rm -r "$temp_dir"
echo "Failed to package package."
2021-03-22 18:13:04 +00:00
exit 1
2021-03-22 16:51:53 +00:00
fi
2021-03-22 16:17:34 +00:00
git_hash=$(git_version "short-tag")
application_version=$(project_version)
echo "Deploying $package_file."
echo "Hash: ${git_hash}, Version: ${application_version}, Target channel: $2."
2021-03-22 16:17:34 +00:00
upload_result=$(curl \
-k \
-X POST \
2018-11-19 18:05:42 +00:00
-F "required_client=$3" \
-F "type=deploy-ui-build" \
-F "channel=$2" \
2021-03-22 16:17:34 +00:00
-F "version=$application_version" \
-F "git_ref=$git_hash" \
-F "secret=${teaclient_deploy_secret}" \
2021-03-22 16:17:34 +00:00
-F "file=@$package_file" \
"$1"
)
2021-03-22 16:51:53 +00:00
rm -r "$temp_dir"
2021-03-22 16:17:34 +00:00
echo "Server upload result: $upload_result"
success=$(echo "${upload_result}" | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
2021-03-22 16:17:34 +00:00
if [[ ! "${success}" == "True" ]]; then
error_message=$(echo "${upload_result}" | python -c "import sys, json; print(json.load(sys.stdin)['msg'])" 2>/dev/null);
echo "Failed to deploy build: ${error_message}"
exit 1
2021-03-22 16:17:34 +00:00
else
echo "Build successfully deployed!"
exit 0
fi