2017-07-10 20:38:09 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Script that runs in the deploy stage after the testing stage of Travis passed.
|
|
|
|
|
# Build artifacts and docs content will be published to different repositories.
|
|
|
|
|
|
|
|
|
|
# The script should immediately exit if any command in the script fails.
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
# Go to the project root directory
|
|
|
|
|
cd $(dirname $0)/../..
|
|
|
|
|
|
2017-09-29 22:23:52 +02:00
|
|
|
# Load the retry-call utility function.
|
|
|
|
|
source scripts/retry-call.sh
|
|
|
|
|
|
2017-07-10 20:38:09 +02:00
|
|
|
# If the current Travis job is triggered by a pull request skip the deployment.
|
|
|
|
|
# This check is necessary because Travis still tries to run the deploy build-stage for
|
|
|
|
|
# pull requests.
|
|
|
|
|
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
|
|
|
|
echo "Build artifacts and docs content will only be deployed in Travis push builds."
|
|
|
|
|
exit 0;
|
|
|
|
|
fi
|
|
|
|
|
|
2017-09-29 22:23:52 +02:00
|
|
|
# Variable the specifies how often the deploy script should be invoked if it fails.
|
|
|
|
|
DEPLOY_RETRIES=1
|
|
|
|
|
|
2017-07-10 20:38:09 +02:00
|
|
|
echo ""
|
|
|
|
|
echo "Starting the deployment script. Running mode: ${DEPLOY_MODE}"
|
|
|
|
|
echo ""
|
|
|
|
|
|
2017-10-11 01:38:53 +02:00
|
|
|
# Deployment of the screenshot tool or dashboard should happen inside of a Cronjob.
|
|
|
|
|
# For example, always deploying the screenshot functions on a per-commit base might cause problems
|
|
|
|
|
# with the screenshot tests, because the functions can be non-responsive for a few seconds.
|
|
|
|
|
if [[ "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then
|
|
|
|
|
if [[ "${DEPLOY_MODE}" == "screenshot-tool" ]]; then
|
|
|
|
|
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/deploy-screenshot-tool.sh
|
2017-10-30 22:33:13 +01:00
|
|
|
elif [[ "${DEPLOY_MODE}" == "dashboard" ]]; then
|
2017-10-11 01:38:53 +02:00
|
|
|
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/deploy-dashboard.sh
|
2017-10-30 22:33:13 +01:00
|
|
|
else
|
|
|
|
|
echo "Docs content and build artifacts won't be published in Travis cronjobs."
|
2017-10-11 01:38:53 +02:00
|
|
|
fi
|
2017-10-30 22:33:13 +01:00
|
|
|
|
2017-10-11 01:38:53 +02:00
|
|
|
# Deployment of the build artifacts and docs-content should only happen on a per-commit base.
|
|
|
|
|
# The target is to provide build artifacts in the GitHub repository for every commit.
|
|
|
|
|
else
|
|
|
|
|
if [[ "${DEPLOY_MODE}" == "build-artifacts" ]]; then
|
|
|
|
|
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-build-artifacts.sh
|
2017-10-30 22:33:13 +01:00
|
|
|
elif [[ "${DEPLOY_MODE}" == "docs-content" ]]; then
|
2017-10-11 01:38:53 +02:00
|
|
|
retryCall ${DEPLOY_RETRIES} ./scripts/deploy/publish-docs-content.sh
|
2017-10-30 22:33:13 +01:00
|
|
|
else
|
|
|
|
|
echo "The dashboard and screenshot-tool will only be deployed in Travis cronjobs."
|
2017-10-11 01:38:53 +02:00
|
|
|
fi
|
2017-07-10 20:38:09 +02:00
|
|
|
fi
|