You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
975 B

  1. #!/bin/bash -x
  2. set -e
  3. OS=$TRAVIS_OS_NAME
  4. # Do not deploy if credentials are not given
  5. if [ "${TRAVIS_SECURE_ENV_VARS}" == "false" ]; then
  6. echo "WARNING: Not deploying as no credentials are given."
  7. exit 0;
  8. fi
  9. # Do not deploy for pull requests
  10. if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
  11. exit 0;
  12. fi
  13. echo "Deploying $1 to Dockerhub"
  14. case $OS in
  15. linux)
  16. echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
  17. # Deploy as debug/release
  18. case "$CONFIG" in
  19. *Debug*)
  20. docker commit $1 movesrwth/$1:travis-debug
  21. docker push movesrwth/$1:travis-debug
  22. ;;
  23. *Release*)
  24. docker commit $1 movesrwth/$1:travis
  25. docker push movesrwth/$1:travis
  26. ;;
  27. *)
  28. echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
  29. ;;
  30. esac
  31. ;;
  32. osx)
  33. echo "Docker deployment on Mac OSX not used."
  34. exit 1
  35. ;;
  36. *)
  37. # Unknown OS
  38. echo "Unsupported OS: $OS"
  39. exit 1
  40. esac