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.

44 lines
1.0 KiB

6 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. expire_in: 1 week
  23. deploy-website:
  24. image: sothr.com/deploy:ubuntu
  25. stage: deploy
  26. variables:
  27. TARGET_DIRECTORY: "/srv/www/sothr.com"
  28. script:
  29. - eval `ssh-agent -s`
  30. - ssh-add <(echo "$SSH_DEPLOY_KEY")
  31. - mkdir -p ~/.ssh
  32. - ssh-keyscan -p $DEPLOY_PORT sothr.com >> ~/.ssh/known_hosts
  33. - mkdir /tmp/deploy
  34. - tar -xvf website.tgz -C /tmp/deploy
  35. - 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
  36. only:
  37. - master
  38. dependencies:
  39. - build-website
  40. tags:
  41. - docker
  42. environment: production