Automatically deploy the newest dev build to web.teaspeak.dev
parent
871dbd337e
commit
b0992cf827
|
@ -20,6 +20,7 @@ node_modules/
|
|||
# Don't add the created packages to git
|
||||
/TeaSpeakUI.tar.gz
|
||||
/TeaWeb-*.zip
|
||||
/auto-build
|
||||
|
||||
/todo.txt
|
||||
/tmp/
|
||||
|
|
24
.travis.yml
24
.travis.yml
|
@ -8,19 +8,31 @@ node_js:
|
|||
services:
|
||||
- docker
|
||||
|
||||
sudo: required
|
||||
|
||||
before_install:
|
||||
# If ever run on windows make sure you don't run this in the git bash!
|
||||
- docker run -dit --name emscripten -v "$(pwd)":"/src/" trzeci/emscripten:sdk-incoming-64bit bash
|
||||
- chmod +x ./scripts/travis.sh
|
||||
- chmod +x ./scripts/travis_deploy.sh
|
||||
- chmod +x ./scripts/travis_deploy_dev_server.sh
|
||||
- chmod +x ./scripts/travis_deploy_github.sh
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
|
||||
script:
|
||||
- "./scripts/travis.sh --enable-release --enable-debug || travis_terminate 1;"
|
||||
- "./scripts/travis_deploy.sh || travis_terminate 1;"
|
||||
stages:
|
||||
- compile
|
||||
# - test We've no tested defined yet
|
||||
- name: deploy-develop
|
||||
if: branch = develop
|
||||
- name: deploy-release
|
||||
if: branch = master
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: compile
|
||||
script: "./scripts/travis.sh --enable-release --enable-debug || travis_terminate 1;"
|
||||
- stage: deploy-develop
|
||||
script: "./scripts/travis_deploy_dev_server.sh || travis_terminate 1;"
|
||||
- stage: deploy-release
|
||||
script: "./scripts/travis_deploy_github.sh || travis_terminate 1;"
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PACKAGES_DIRECTORY="auto-build/packages/"
|
||||
if [[ -z "${SSH_KEY}" ]]; then
|
||||
echo "Missing environment variable SSH_KEY. Please set it before using this script!"
|
||||
exit 1
|
||||
fi
|
||||
echo "${SSH_KEY}" | base64 --decode > /tmp/sftp_key
|
||||
chmod 600 /tmp/sftp_key
|
||||
|
||||
[[ $? -ne 0 ]] && {
|
||||
echo "Failed to write SSH key"
|
||||
exit 1
|
||||
}
|
||||
cd "$(dirname "$0")/.." || { echo "Failed to enter base dir"; exit 1; }
|
||||
|
||||
file=$(find . -maxdepth 1 -name "*.zip" -print)
|
||||
[[ $(echo "$file" | wc -l) -ne 1 ]] && {
|
||||
echo "Invalid release file count (Expected 1 but got $(echo "$file" | wc -l))"
|
||||
exit 1
|
||||
}
|
||||
[[ ! -e "$file" ]] && {
|
||||
echo "File does not exists"
|
||||
exit 1
|
||||
}
|
||||
#TeaSpeak-Travis-Web
|
||||
# ssh -oStrictHostKeyChecking=no $h TeaSpeak-Travis-Web@dev.web.teaspeak.de
|
||||
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@dev.web.teaspeak.de rm "tmp-upload/*.zip" # Cleanup the old files
|
||||
[[ $? -ne 0 ]] && {
|
||||
echo "Failed to delete the old .zip files"
|
||||
}
|
||||
|
||||
filename="$PACKAGES_DIRECTORY/TeaWeb-Release-$(git rev-parse --short HEAD)"
|
||||
sftp -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@dev.web.teaspeak.de << EOF
|
||||
put $file tmp-upload/$filename
|
||||
EOF
|
||||
[[ $? -ne 0 ]] && {
|
||||
echo "Failed to upload the .zip file"
|
||||
}
|
||||
ssh -oStrictHostKeyChecking=no -oIdentitiesOnly=yes -i /tmp/sftp_key TeaSpeak-Travis-Web@dev.web.teaspeak.de "./unpack.sh tmp-upload/$filename"
|
||||
exit $?
|
Loading…
Reference in New Issue