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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

43 lines
1018 B

5 years ago
  1. stages:
  2. - build
  3. - deploy
  4. build-website:
  5. image: sothr.com/hugo:0.54.0
  6. stage: build
  7. variables:
  8. HUGO_THEME: "pure"
  9. HUGO_BASEURL: "https://sothr.com/"
  10. script:
  11. - export HUGO_SOURCE="$PWD"
  12. - /run.sh --minify
  13. - tar -czvf website.tgz -C /output/ .
  14. only:
  15. - master
  16. - develop
  17. tags:
  18. - docker
  19. artifacts:
  20. paths:
  21. - website.tgz
  22. deploy-website:
  23. image: sothr.com/deploy:ubuntu
  24. stage: deploy
  25. variables:
  26. TARGET_DIRECTORY: "/srv/www/sothr.com"
  27. script:
  28. - eval `ssh-agent -s`
  29. - ssh-add <(echo "$SSH_DEPLOY_KEY")
  30. - mkdir -p ~/.ssh
  31. - ssh-keyscan -p $DEPLOY_PORT sothr.com >> ~/.ssh/known_hosts
  32. - mkdir /tmp/deploy
  33. - tar -xvf website.tgz -C /tmp/deploy
  34. - rsync -avz --delete-delay -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $DEPLOY_PORT" --progress /tmp/deploy/* $DEPLOY_USER@$DEPLOY_HOST:$TARGET_DIRECTORY
  35. only:
  36. - master
  37. dependencies:
  38. - build-website
  39. tags:
  40. - docker
  41. environment: production