.drone.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. kind: pipeline
  2. type: docker
  3. name: blog
  4. steps:
  5. # 使用缓存
  6. - name: restore-cache
  7. image: drillster/drone-volume-cache
  8. settings:
  9. restore: true
  10. mount:
  11. - ./node_modules
  12. volumes:
  13. - name: node_cache
  14. path: /cache
  15. # 打包
  16. - name: build-blog
  17. image: node:16-alpine
  18. commands:
  19. - npm install -g hexo-cli
  20. - npm install --registry https://registry.npm.taobao.org
  21. - hexo D
  22. # 更新缓存
  23. - name: rebuild-cache
  24. image: drillster/drone-volume-cache
  25. settings:
  26. rebuild: true
  27. mount:
  28. - ./node_modules
  29. volumes:
  30. - name: node_cache
  31. path: /cache
  32. # 部署
  33. - name: deploy-blog
  34. image: appleboy/drone-scp
  35. settings:
  36. host: 43.139.174.194
  37. port: 22
  38. username: root
  39. password:
  40. from_secret: ssh_key
  41. command_timeout: 3m
  42. # 设置要将打包户的文件部署到的文件地址
  43. target: /mydata/blog
  44. source: ./public/*
  45. rm: true
  46. strip_components: 1
  47. when:
  48. status:
  49. - success
  50. volumes:
  51. - name: node_cache
  52. host:
  53. path: /mydata/node