Automatically deploy the newest dev build to web.teaspeak.dev

canary
WolverinDEV 2020-04-09 17:36:12 +02:00
parent 871dbd337e
commit b0992cf827
4 changed files with 60 additions and 6 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ node_modules/
# Don't add the created packages to git # Don't add the created packages to git
/TeaSpeakUI.tar.gz /TeaSpeakUI.tar.gz
/TeaWeb-*.zip /TeaWeb-*.zip
/auto-build
/todo.txt /todo.txt
/tmp/ /tmp/

View File

@ -8,19 +8,31 @@ node_js:
services: services:
- docker - docker
sudo: required
before_install: before_install:
# If ever run on windows make sure you don't run this in the git bash! # 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 - docker run -dit --name emscripten -v "$(pwd)":"/src/" trzeci/emscripten:sdk-incoming-64bit bash
- chmod +x ./scripts/travis.sh - 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: branches:
only: only:
- master - master
- develop - develop
script: stages:
- "./scripts/travis.sh --enable-release --enable-debug || travis_terminate 1;" - compile
- "./scripts/travis_deploy.sh || travis_terminate 1;" # - 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;"

View File

@ -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 $?