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.

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