Updated the script helpers
parent
084dd4cb63
commit
e5bedb0c44
|
@ -4,6 +4,7 @@
|
|||
"description": "Welcome here! This repository is created with two reasons:\n 1. People can bring their own ideas and follow their implementation\n 2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.",
|
||||
"scripts": {
|
||||
"compile-project-base": "tsc -p tsbaseconfig.json",
|
||||
"compile-tr-gen": "tsc -p tools/trgen/tsconfig.json",
|
||||
"trgen": "node tools/trgen/index.js",
|
||||
"tsc": "tsc",
|
||||
"compile-scss": "sass loader/css/index.scss:loader/css/index.css",
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
source "$(dirname "$0")/resolve_commands.sh"
|
||||
cd "$(dirname "$0")/../" || { echo "Failed to enter the base directory"; exit 1; }
|
||||
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Invalid argument count!"
|
||||
exit 1
|
||||
|
@ -41,7 +39,7 @@ if [[ $_exit_code -ne 0 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo "Generating required build tooks"
|
||||
echo "Generating required build hooks"
|
||||
chmod +x ./tools/build_trgen.sh
|
||||
./tools/build_trgen.sh; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BASEDIR=$(dirname "$0")
|
||||
# shellcheck disable=SC1090
|
||||
source "${BASEDIR}/resolve_commands.sh"
|
||||
cd "$BASEDIR/../" || { echo "Failed to enter parent directory!"; exit 1; }
|
||||
|
||||
#Shared
|
||||
|
|
|
@ -35,7 +35,7 @@ function cleanup_files() {
|
|||
for file in "${files[@]}"
|
||||
do :
|
||||
echo " - $file"
|
||||
rm ${file}
|
||||
rm "${file}"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -2,107 +2,52 @@
|
|||
|
||||
# Example usage: ./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"
|
||||
|
||||
cd "$(dirname "$0")/../" || { echo "failed to enter base directory"; exit 1; }
|
||||
cd "$(dirname "$0")" || { echo "failed to enter base directory"; exit 1; }
|
||||
source "./helper.sh"
|
||||
|
||||
if [[ "$#" -ne 3 ]]; then
|
||||
echo "Illegal number of parameters (url | channel | required version)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d client-api/environment/ui-files/ ]]; then
|
||||
echo "Missing UI Files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
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!"
|
||||
|
||||
if ! rm ${TMP_FILE_NAME}; then
|
||||
echo "Failed to delete file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
GIT_HASH=$(git rev-parse --verify --short HEAD)
|
||||
APPLICATION_VERSION=$(< 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/ || {
|
||||
echo "Missing UI files directory"
|
||||
package_file=$(find_release_package "client" "release")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "$package_file"
|
||||
exit 1
|
||||
}
|
||||
if [[ -e ${TMP_DIR_NAME} ]]; then
|
||||
if ! rm -r ${TMP_DIR_NAME}; then
|
||||
echo "Failed to remove temporary directory!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cp -rL raw ${TMP_DIR_NAME}
|
||||
|
||||
while IFS= read -r -d '' file
|
||||
do
|
||||
echo "Evaluating php file $file"
|
||||
__cur_dir=$(pwd)
|
||||
cd "$(dirname "${file}")" || { echo "Failed to enter php file directory"; exit 1; }
|
||||
php_result=$(php "$(basename "${file}")" 2> /dev/null)
|
||||
CODE=$?
|
||||
if [[ ${CODE} -ne 0 ]]; then
|
||||
echo "Failed to evaluate php file $file!"
|
||||
echo "Return code $CODE"
|
||||
exit 1
|
||||
fi
|
||||
git_hash=$(git_version "short-tag")
|
||||
application_version=$(project_version)
|
||||
echo "Deploying $package_file."
|
||||
echo "Hash: ${git_hash}, Version: ${application_version}, Target channel: $2."
|
||||
|
||||
cd "${__cur_dir}" || { echo "failed to enter original dir"; exit 1; }
|
||||
echo "${php_result}" > "${file::-4}.html"
|
||||
done < <(find "${TMP_DIR_NAME}" -name '*.php' -print0)
|
||||
|
||||
cd ${TMP_DIR_NAME} || { echo "failed to enter the temp dir"; exit 1; }
|
||||
tar chvzf ${TMP_FILE_NAME} ./*; _exit_code=$?
|
||||
if [[ $_exit_code -ne 0 ]]; then
|
||||
echo "Failed to pack file ($_exit_code)"
|
||||
exit 1
|
||||
fi
|
||||
mv ${TMP_FILE_NAME} ../../../../
|
||||
cd ../
|
||||
rm -r ${TMP_DIR_NAME}
|
||||
cd ../../../
|
||||
|
||||
RESP=$(curl \
|
||||
upload_result=$(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 "version=$application_version" \
|
||||
-F "git_ref=$git_hash" \
|
||||
-F "secret=${teaclient_deploy_secret}" \
|
||||
-F "file=@$(pwd)/TeaSpeakUI.tar.gz" \
|
||||
-F "file=@$package_file" \
|
||||
"$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); _exit_code=$?
|
||||
if [[ $_exit_code -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}"
|
||||
echo "Server upload result: $upload_result"
|
||||
success=$(echo "${upload_result}" | python -c "import sys, json; print(json.load(sys.stdin)['success'])")
|
||||
|
||||
rm ${TMP_FILE_NAME}
|
||||
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
|
||||
else
|
||||
echo "Build successfully deployed!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Build deployed!"
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
response=$(git diff-index HEAD -- . ':!package-lock.json' ':!vendor/')
|
||||
if [[ "$response" != "" ]]; then
|
||||
if [[ "$1" == "sort-tag" ]]; then
|
||||
echo "0000000"
|
||||
fi
|
||||
if [[ "$1" == "name" ]]; then
|
||||
echo "custom build"
|
||||
fi
|
||||
if [[ "$1" == "file-name" ]]; then
|
||||
echo "custom"
|
||||
fi
|
||||
exit 1
|
||||
else
|
||||
if [[ "$1" == "sort-tag" ]]; then
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
if [[ "$1" == "name" ]]; then
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
if [[ "$1" == "file-name" ]]; then
|
||||
git rev-parse --short HEAD
|
||||
fi
|
||||
exit 0
|
||||
fi
|
|
@ -0,0 +1,124 @@
|
|||
build_package_directory="dist-package"
|
||||
|
||||
# Get the projects absolute directory
|
||||
project_directory() {
|
||||
realpath "$(dirname "$(pwd)/${BASH_SOURCE[0]}")/.."
|
||||
}
|
||||
|
||||
# Get the project version specified within the package.json file
|
||||
project_version() {
|
||||
< "$(project_directory)/package.json" python -c "import sys, json; print(json.load(sys.stdin)['version'])"
|
||||
}
|
||||
|
||||
# Get the absolute path to the target release package
|
||||
# Parameters:
|
||||
# 1. The build target
|
||||
# Values: "client" | "web"
|
||||
# 2. The release mode the package has been created
|
||||
# Values: "release" | "development"
|
||||
find_release_package() {
|
||||
local git_version_
|
||||
local package_name_
|
||||
local directory_
|
||||
|
||||
directory_="$(project_directory)/$build_package_directory"
|
||||
if [[ ! -d "$directory_" ]]; then
|
||||
echo "Missing package directory $directory_. May you haven't yet build a package."
|
||||
return 1
|
||||
fi
|
||||
|
||||
git_version_="$(git_version "short-tag")"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "We're in a development state and have a dirty work tree. Can't find release packages."
|
||||
return 1
|
||||
fi
|
||||
|
||||
package_name_="$(release_package_name "$1" "$2")"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to generate target package name: $package_name_"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$directory_/$package_name_" ]]; then
|
||||
echo "Missing target package at $directory_/$package_name_ (git version: $git_version_, target: $1, release mode: $2)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$directory_/$package_name_"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Generate the target build package name
|
||||
# Parameters:
|
||||
# 1. The build target
|
||||
# Values: "client" | "web"
|
||||
# 2. The release mode the package has been created
|
||||
# Values: "release" | "development"
|
||||
release_package_name() {
|
||||
local prefix_
|
||||
|
||||
case "$1" in
|
||||
"client")
|
||||
prefix_="TeaClient"
|
||||
;;
|
||||
"web")
|
||||
prefix_="TeaWeb"
|
||||
;;
|
||||
*)
|
||||
echo "invalid package mode"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$2" in
|
||||
"release" | "development")
|
||||
;;
|
||||
*)
|
||||
echo "invalid package mode"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# This must line up with the package name generated within the webpack config!
|
||||
echo "${prefix_}-$2-$(git_version "short-tag").zip"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Get the current working tree git version.
|
||||
# If the working tree is dirty (modified) the function returns 1.
|
||||
# Possible modes (first parameter):
|
||||
# short-tag: Returns a 6 digit git rev
|
||||
# long-tag: The full git revision hash
|
||||
#
|
||||
# Influential environment variables:
|
||||
# ignore_dirty_worktree: If set to 1 it ignores if the worktree is dirty
|
||||
git_version() {
|
||||
response=$(git diff-index HEAD -- "$(project_directory)" ':!package-lock.json' ':!vendor/')
|
||||
if [[ -z "$response" || "${ignore_dirty_worktree:=0}" -eq 1 ]]; then
|
||||
case "$1" in
|
||||
"short-tag" | "name" | "file-name")
|
||||
git rev-parse --short HEAD
|
||||
;;
|
||||
"long-tag")
|
||||
git rev-parse HEAD
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "unknown type"
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
else
|
||||
# We're in development
|
||||
case "$1" in
|
||||
"short-tag" | "name" | "file-name" | "long-tag")
|
||||
echo "0000000"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "unknown type"
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
fi
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function execute_tsc() {
|
||||
# shellcheck disable=SC2068
|
||||
execute_npm_command tsc $@
|
||||
}
|
||||
|
||||
function execute_npm_command() {
|
||||
command_name=$1
|
||||
command_variable="command_$command_name"
|
||||
#echo "Variable names $command_variable"
|
||||
|
||||
if [[ "${!command_variable}" == "" ]]; then
|
||||
node_bin=$(npm bin)
|
||||
#echo "Node root ${node_bin}"
|
||||
|
||||
if [[ ! -e "${node_bin}/${command_name}" ]]; then
|
||||
echo "Could not find \"$command_name\" command"
|
||||
echo "May type npm install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval "${command_variable}=\"${node_bin}/${command_name}\""
|
||||
fi
|
||||
|
||||
echo "Arguments: ${@:2}"
|
||||
${!command_variable} ${@:2}
|
||||
}
|
|
@ -60,11 +60,11 @@ function parse_arguments() {
|
|||
function execute() {
|
||||
time_begin=$(date +%s%N)
|
||||
|
||||
echo "> Executing step: $1" >> ${LOG_FILE}
|
||||
echo "> Executing step: $1" >> "${LOG_FILE}"
|
||||
echo -e "\e[32m> Executing step: $1\e[0m"
|
||||
#Execute the command
|
||||
for command in "${@:3}"; do
|
||||
echo "$> $command" >> ${LOG_FILE}
|
||||
echo "$> $command" >> "${LOG_FILE}"
|
||||
if [[ ${build_verbose} -gt 0 ]]; then
|
||||
echo "$> $command"
|
||||
fi
|
||||
|
@ -72,18 +72,18 @@ function execute() {
|
|||
error=""
|
||||
if [[ ${build_verbose} -gt 0 ]]; then
|
||||
if [[ -f ${LOG_FILE}.tmp ]]; then
|
||||
rm ${LOG_FILE}.tmp
|
||||
rm "${LOG_FILE}.tmp"
|
||||
fi
|
||||
${command} |& tee ${LOG_FILE}.tmp | grep -E '^[^(/\S*/libstdc++.so\S*: no version information available)].*'
|
||||
${command} |& tee "${LOG_FILE}.tmp" | grep -E '^[^(/\S*/libstdc++.so\S*: no version information available)].*'
|
||||
|
||||
error_code=${PIPESTATUS[0]}
|
||||
error=$(cat ${LOG_FILE}.tmp)
|
||||
cat ${LOG_FILE}.tmp >> ${LOG_FILE}
|
||||
rm ${LOG_FILE}.tmp
|
||||
error=$(cat "${LOG_FILE}.tmp")
|
||||
cat "${LOG_FILE}.tmp" >> "${LOG_FILE}"
|
||||
rm "${LOG_FILE}.tmp"
|
||||
else
|
||||
error=$(${command} 2>&1)
|
||||
error_code=$?
|
||||
echo "$error" >> ${LOG_FILE}
|
||||
echo "$error" >> "${LOG_FILE}"
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
|
||||
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
|
||||
source ./scripts/travis/properties.sh
|
||||
source ./scripts/helper.sh
|
||||
|
||||
git_rev=$(git rev-parse --short HEAD)
|
||||
[[ ! "$git_rev" =~ [a-z0-9]{6} ]] && {
|
||||
echo "Failed to parse git rev. Received: '$git_rev'."
|
||||
exit 1
|
||||
}
|
||||
|
||||
git_rev=$(git_version "short-tag")
|
||||
if [[ "$1" == "release" ]]; then
|
||||
echo "Releasing $git_rev as release"
|
||||
rolling_tag="latest"
|
||||
|
@ -20,6 +16,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# FIXME: This dosn't work anymore
|
||||
zip_file=$(find "$PACKAGES_DIRECTORY" -maxdepth 1 -name "TeaWeb-release*.zip" -print)
|
||||
[[ $(echo "$zip_file" | wc -l) -ne 1 ]] && {
|
||||
echo "Invalid .zip file count (Expected 1 but got $(echo "$zip_file" | wc -l)): ${zip_file[*]}"
|
||||
|
|
|
@ -1,98 +1,92 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
|
||||
cd "$(dirname "$0")/../../" || {
|
||||
echo "Failed to enter base dir"
|
||||
exit 1
|
||||
}
|
||||
source ./scripts/travis/properties.sh
|
||||
source ./scripts/helper.sh
|
||||
|
||||
if [[ -z "${GIT_AUTHTOKEN}" ]]; then
|
||||
echo "GIT_AUTHTOKEN isn't set. Don't deploying build!"
|
||||
exit 0
|
||||
echo "GIT_AUTHTOKEN isn't set. Don't deploying build!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
GIT_COMMIT_SHORT=$(git rev-parse --short HEAD)
|
||||
GIT_COMMIT_LONG=$(git rev-parse HEAD)
|
||||
echo "Deploying $GIT_COMMIT_SHORT ($GIT_COMMIT_LONG) to github."
|
||||
git_release_executable="/tmp/git-release"
|
||||
install_git_release() {
|
||||
if [[ -x "${git_release_executable}" ]]; then
|
||||
# File already available. No need to install it.
|
||||
return 0
|
||||
fi
|
||||
|
||||
GIT_RELEASE_EXECUTABLE="/tmp/git-release"
|
||||
if [[ ! -x ${GIT_RELEASE_EXECUTABLE} ]]; then
|
||||
if [[ ! -f ${GIT_RELEASE_EXECUTABLE} ]]; then
|
||||
echo "Downloading github-release-linux (1.2.4)"
|
||||
if [[ ! -f ${git_release_executable} ]]; then
|
||||
echo "Downloading github-release-linux (1.2.4)"
|
||||
|
||||
if [[ -f /tmp/git-release.gz ]]; then
|
||||
rm /tmp/git-release.gz
|
||||
fi
|
||||
wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz -O /tmp/git-release.gz -q;
|
||||
[[ $? -eq 0 ]] || {
|
||||
echo "Failed to download github-release-linux"
|
||||
exit 1
|
||||
}
|
||||
|
||||
gunzip /tmp/git-release.gz; _exit_code=$?;
|
||||
[[ $_exit_code -eq 0 ]] || {
|
||||
echo "Failed to unzip github-release-linux"
|
||||
exit 1
|
||||
}
|
||||
chmod +x /tmp/git-release;
|
||||
|
||||
echo "Download of github-release-linux (1.2.4) finished"
|
||||
else
|
||||
chmod +x ${GIT_RELEASE_EXECUTABLE}
|
||||
if [[ -f /tmp/git-release.gz ]]; then
|
||||
rm /tmp/git-release.gz
|
||||
fi
|
||||
wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz -O /tmp/git-release.gz -q
|
||||
[[ $? -eq 0 ]] || {
|
||||
echo "Failed to download github-release-linux"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ ! -x ${GIT_RELEASE_EXECUTABLE} ]]; then
|
||||
echo "git-release isn't executable"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
gunzip /tmp/git-release.gz
|
||||
_exit_code=$?
|
||||
[[ $_exit_code -eq 0 ]] || {
|
||||
echo "Failed to unzip github-release-linux"
|
||||
exit 1
|
||||
}
|
||||
chmod +x /tmp/git-release
|
||||
|
||||
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
|
||||
echo "Generating release"
|
||||
${GIT_RELEASE_EXECUTABLE} release \
|
||||
--repo "TeaWeb" \
|
||||
--owner "TeaSpeak" \
|
||||
--token "${GIT_AUTHTOKEN}" \
|
||||
--title "Travis autobuild ${GIT_COMMIT_SHORT}" \
|
||||
--tag "${GIT_COMMIT_SHORT}" \
|
||||
--description "This is a autobuild release from travis"
|
||||
[[ $? -eq 0 ]] || {
|
||||
echo "Failed to generate git release"
|
||||
echo "Download of github-release-linux (1.2.4) finished"
|
||||
else
|
||||
chmod +x ${git_release_executable}
|
||||
fi
|
||||
|
||||
if [[ ! -x ${git_release_executable} ]]; then
|
||||
echo "git-release isn't executable"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
install_git_release
|
||||
|
||||
git_versions_tag=$(git_version "short-tag")
|
||||
echo "Deploying $git_versions_tag ($(git_version "long-tag")) to GitHub."
|
||||
|
||||
echo "Generating release tag"
|
||||
${git_release_executable} release \
|
||||
--repo "TeaWeb" \
|
||||
--owner "TeaSpeak" \
|
||||
--token "${GIT_AUTHTOKEN}" \
|
||||
--title "Travis auto build $git_versions_tag" \
|
||||
--tag "$git_versions_tag" \
|
||||
--description "This is a auto build release from travis"
|
||||
|
||||
[[ $? -eq 0 ]] || {
|
||||
echo "Failed to generate git release"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Uploading release files"
|
||||
folders=("${LOG_FILE}" "${PACKAGES_DIRECTORY}")
|
||||
uploaded_files=()
|
||||
failed_files=()
|
||||
upload_package() {
|
||||
local package_file
|
||||
package_file=$(find_release_package "web" "$1")
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo "Uploading $1 package ($package_file)"
|
||||
${git_release_executable} upload \
|
||||
--repo "TeaWeb" \
|
||||
--owner "TeaSpeak" \
|
||||
--token "${GIT_AUTHTOKEN}" \
|
||||
--tag "$git_versions_tag" \
|
||||
--file "$package_file" \
|
||||
--name "$(basename "$package_file")"
|
||||
|
||||
for folder in "${folders[@]}"; do
|
||||
echo "Scanning folder $folder"
|
||||
if [[ ! -d ${folder} ]]; then
|
||||
continue;
|
||||
fi
|
||||
echo "Successfully uploaded $1 package"
|
||||
else
|
||||
echo "Skipping $1 package upload: $package_file"
|
||||
fi
|
||||
}
|
||||
|
||||
for file in ${folder}*; do
|
||||
if [[ -d ${file} ]]; then
|
||||
echo " Skipping directory `basename $file` ($file)"
|
||||
continue
|
||||
fi
|
||||
echo " Found entry `basename $file` ($file). Uploading file.";
|
||||
|
||||
${GIT_RELEASE_EXECUTABLE} upload \
|
||||
--repo "TeaWeb" \
|
||||
--owner "TeaSpeak" \
|
||||
--token "${GIT_AUTHTOKEN}" \
|
||||
--tag "${GIT_COMMIT_SHORT}" \
|
||||
--file "$file" \
|
||||
--name "`basename $file`"
|
||||
|
||||
[[ $? -eq 0 ]] && {
|
||||
echo " Uploaded.";
|
||||
uploaded_files+=("$file")
|
||||
} || {
|
||||
echo "Failed to generate git release"
|
||||
failed_files+=("$file")
|
||||
}
|
||||
done
|
||||
done
|
||||
|
||||
echo "Successfully uploaded ${#uploaded_files[@]} files. ${#failed_files[@]} uploads failed."
|
||||
upload_package "development"
|
||||
upload_package "release"
|
||||
exit 0
|
|
@ -5,8 +5,12 @@ if [[ -z "$1" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$(dirname "$0")/../../" || { echo "Failed to enter base dir"; exit 1; }
|
||||
cd "$(dirname "$0")/../../" || {
|
||||
echo "Failed to enter base dir"
|
||||
exit 1
|
||||
}
|
||||
source ./scripts/travis/properties.sh
|
||||
source ./scripts/helper.sh
|
||||
|
||||
if [[ -z "${SSH_KEY}" ]]; then
|
||||
echo "Missing environment variable SSH_KEY. Please set it before using this script!"
|
||||
|
@ -20,31 +24,28 @@ chmod 600 /tmp/sftp_key
|
|||
exit 1
|
||||
}
|
||||
|
||||
file=$(find "$PACKAGES_DIRECTORY" -maxdepth 1 -name "TeaWeb-release*.zip" -print)
|
||||
[[ $(echo "$file" | wc -l) -ne 1 ]] && {
|
||||
echo "Invalid release file count (Expected 1 but got $(echo "$file" | wc -l)): ${file[*]}"
|
||||
|
||||
package_file=$(find_release_package "web" "release")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "$package_file"
|
||||
exit 1
|
||||
}
|
||||
[[ ! -e "$file" ]] && {
|
||||
echo "File ($file) does not exists"
|
||||
exit 1
|
||||
}
|
||||
#TeaSpeak-Travis-Web
|
||||
# ssh -oStrictHostKeyChecking=no $h TeaSpeak-Travis-Web@dev.web.teaspeak.de
|
||||
fi
|
||||
|
||||
upload_name=$(basename "$package_file")
|
||||
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev rm "tmp-upload/*.zip" # Cleanup the old files
|
||||
_exit_code=$?
|
||||
[[ $_exit_code -ne 0 ]] && {
|
||||
echo "Failed to delete the old .zip files ($_exit_code)"
|
||||
}
|
||||
|
||||
filename="TeaWeb-release-$(git rev-parse --short HEAD).zip"
|
||||
sftp -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev << EOF
|
||||
put $file tmp-upload/$filename
|
||||
put $package_file tmp-upload/$upload_name
|
||||
EOF
|
||||
_exit_code=$?
|
||||
[[ $_exit_code -ne 0 ]] && {
|
||||
echo "Failed to upload the .zip file ($_exit_code)"
|
||||
exit 1
|
||||
}
|
||||
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev "./unpack.sh $1 tmp-upload/$filename"
|
||||
|
||||
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@web.teaspeak.dev "./unpack.sh $1 tmp-upload/$upload_name"
|
||||
exit $?
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
BASEDIR=$(dirname "$0")
|
||||
cd "$BASEDIR" || { echo "Failed to enter script base dir"; exit 1; }
|
||||
source ../scripts/resolve_commands.sh
|
||||
|
||||
function generate_declaration() {
|
||||
echo "Generating declarations for project $1 ($2)"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {TranslationEntry} from "./Definitions";
|
||||
import {TranslationEntry} from "../Definitions";
|
||||
|
||||
export const deltaTranslations = (result: TranslationEntry[], fileName: string, processSpeed: number, newTranslations: TranslationEntry[]) => {
|
||||
let deletedTranslations = 0;
|
||||
|
|
Loading…
Reference in New Issue