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.

73 lines
2.3 KiB

  1. ---
  2. resources:
  3. - name: git-resource
  4. type: git
  5. icon: git
  6. source:
  7. uri: ssh://git@git.nulloctet.com:8437/warricksothr/sothr-dot-com.git
  8. private_key: |
  9. ((pull_key))
  10. ignore_paths:
  11. - pipeline.yml
  12. - upload_pipeline.sh
  13. - README.md
  14. jobs:
  15. - name: publish
  16. plan:
  17. - get: git-resource
  18. trigger: true
  19. - task: build-site
  20. config:
  21. platform: linux
  22. image_resource:
  23. type: registry-image
  24. source:
  25. repository: ((nexus_docker_read.host))/sothr/hugo
  26. username: ((nexus_docker_read.username))
  27. password: ((nexus_docker_read.password))
  28. inputs:
  29. - name: git-resource
  30. outputs:
  31. - name: site-html
  32. params:
  33. HUGO_THEME: pure
  34. HUGO_BASEURL: https://sothr.com/
  35. run:
  36. path: /bin/sh
  37. args:
  38. - -c
  39. - |
  40. export HUGO_SOURCE="${PWD}/git-resource"
  41. /run.sh --minify
  42. tar -czvf site-html/website.tgz -C /output/ .
  43. - task: publish-site
  44. config:
  45. platform: linux
  46. image_resource:
  47. type: registry-image
  48. source:
  49. repository: ((nexus_docker_read.host))/sothr/deploy
  50. tag: "stable"
  51. username: ((nexus_docker_read.username))
  52. password: ((nexus_docker_read.password))
  53. inputs:
  54. - name: site-html
  55. params:
  56. DEPLOY_KEY: ((deploy.key))
  57. DEPLOY_HOST: ((deploy.host))
  58. DEPLOY_PORT: ((deploy.port))
  59. DEPLOY_USER: ((deploy.user))
  60. DEPLOY_TARGET: ((deploy.target))
  61. run:
  62. path: /bin/bash
  63. args:
  64. - -c
  65. - |
  66. eval `ssh-agent -s`
  67. ssh-add <(echo "${DEPLOY_KEY}")
  68. mkdir -p ~/.ssh
  69. ssh-keyscan -p ${DEPLOY_PORT} ${DEPLOY_HOST} >> ~/.ssh/known_hosts
  70. mkdir /tmp/deploy
  71. tar -xzvf site-html/website.tgz -C /tmp/deploy
  72. rsync -avz --delete-delay -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${DEPLOY_PORT}" --progress /tmp/deploy/* ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_TARGET}