TeaWeb/scripts/deploy_ui_files.sh
WolverinDEV 664f8b2abd
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 16:08:10 +01:00

102 lines
No EOL
2.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# ./scripts/deploy_ui_files.sh http://dev.clientapi.teaspeak.de/api.php test 1.1.0
TMP_FILE_NAME="TeaSpeakUI.tar.gz"
TMP_DIR_NAME="tmp"
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
if [[ "$#" -ne 3 ]]; then
echo "Illegal number of parameters (url | channel | required version)"
exit 1
fi
if [[ ! -d client&&pi/environment/ui-files/ ]]; then
echo "Missing UI Files"
exit 1
fi
if [[ "${teaclient_deploy_secret}" == "" ]]; then
echo "Missing deploy secret!"
exit 1
fi
if [[ -e "${TMP_FILE_NAME}" ]]; then
echo "Temp file already exists!"
echo "Deleting it!"
rm ${TMP_FILE_NAME}
if [[ $? -ne 0 ]]; then
echo "Failed to delete file"
exit 1
fi
fi
GIT_HASH=$(git rev-parse --verify --short HEAD)
APPLICATION_VERSION=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['version'])")
echo "Git hash ${GIT_HASH} on version ${APPLICATION_VERSION} on channel $2"
#Packaging the app
cd client-api/environment/ui-files/
if [[ -e ${TMP_DIR_NAME} ]]; then
rm -r ${TMP_DIR_NAME}
if [[ $? -ne 0 ]]; then
echo "Failed to remove temporary directory!"
exit 1
fi
fi
cp -rL raw ${TMP_DIR_NAME}
for file in $(find ${TMP_DIR_NAME} -name '*.php'); do
echo "Evaluating php file $file"
RESULT=$(php "${file}" 2> /dev/null)
CODE=$?
if [[ ${CODE} -ne 0 ]]; then
echo "Failed to evaluate php file $file!"
echo "Return code $CODE"
exit 1
fi
echo "${RESULT}" > "${file::-4}.html"
done
cd ${TMP_DIR_NAME}
tar chvzf ${TMP_FILE_NAME} *
if [[ $? -ne 0 ]]; then
echo "Failed to pack file"
exit 1
fi
mv ${TMP_FILE_NAME} ../../../../
cd ../
rm -r ${TMP_DIR_NAME}
cd ../../../
RESP=$(curl \
-k \
-X POST \
-F "required_client=$3" \
-F "type=deploy-ui-build" \
-F "channel=$2" \
-F "version=$APPLICATION_VERSION" \
-F "git_ref=$GIT_HASH" \
-F "secret=${teaclient_deploy_secret}" \
-F "file=@`pwd`/TeaSpeakUI.tar.gz" \
$1
)
echo "$RESP"
SUCCESS=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
if [[ ! "${SUCCESS}" == "True" ]]; then
ERROR=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['error'])" 2>/dev/null)
if [[ $? -ne 0 ]]; then
ERROR=$(echo ${RESP} | python -c "import sys, json; print(json.load(sys.stdin)['msg'])" 2>/dev/null)
fi
echo "Failed to deploy build!"
echo "${ERROR}"
rm ${TMP_FILE_NAME}
exit 1
fi
echo "Build deployed!"