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.

70 lines
2.2 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. run:
  33. path: /bin/sh
  34. args:
  35. - -c
  36. - |
  37. export HUGO_SOURCE="${PWD}/git-resource"
  38. /run.sh --minify
  39. tar -czvf site-html/website.tgz -C /output/ .
  40. - task: publish-site
  41. config:
  42. platform: linux
  43. image_resource:
  44. type: registry-image
  45. source:
  46. repository: ((nexus_docker_read.host))/sothr/deploy
  47. tag: "stable"
  48. username: ((nexus_docker_read.username))
  49. password: ((nexus_docker_read.password))
  50. inputs:
  51. - name: site-html
  52. params:
  53. DEPLOY_KEY: ((deploy.key))
  54. DEPLOY_HOST: ((deploy.host))
  55. DEPLOY_PORT: ((deploy.port))
  56. DEPLOY_USER: ((deploy.user))
  57. DEPLOY_TARGET: ((deploy.target))
  58. run:
  59. path: /bin/bash
  60. args:
  61. - -c
  62. - |
  63. eval `ssh-agent -s`
  64. ssh-add <(echo "${DEPLOY_KEY}")
  65. mkdir -p ~/.ssh
  66. ssh-keyscan -p ${DEPLOY_PORT} ${DEPLOY_HOST} >> ~/.ssh/known_hosts
  67. mkdir /tmp/deploy
  68. tar -xzvf site-html/website.tgz -C /tmp/deploy
  69. 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}