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.

46 lines
1.0 KiB

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