.drone.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. kind: pipeline
  2. type: docker
  3. name: default
  4. steps:
  5. - name: install-node
  6. image: node:16.10.0
  7. commands:
  8. - npm config set registry https://registry.npmmirror.com
  9. - yarn config set registry https://registry.npmmirror.com
  10. - yarn config list
  11. - yarn config set proxy http://192.168.1.5:10809 -g
  12. - yarn config set https-proxy http://192.168.1.5:10809 -g
  13. - yarn install
  14. - yarn build:test
  15. - name: zip-dist
  16. image: alpine:3.12
  17. commands:
  18. - apk add zip
  19. - zip -r dist.zip dist
  20. - name: push
  21. image: appleboy/drone-scp
  22. settings:
  23. host:
  24. from_secret: TestServerIP
  25. port:
  26. from_secret: Port
  27. username: root
  28. password:
  29. from_secret: TestServerPwd
  30. command_timeout: 3m
  31. target: /opt/docker/other/nginx/html/
  32. source:
  33. - dist.zip
  34. status:
  35. - success
  36. - name: deploy
  37. image: appleboy/drone-ssh
  38. settings:
  39. host:
  40. from_secret: TestServerIP
  41. username: root
  42. password:
  43. from_secret: TestServerPwd
  44. port:
  45. from_secret: Port
  46. script:
  47. - 'cd /opt/docker/other/nginx/html'
  48. - 'unzip dist.zip'
  49. - 'rm -rf dist.zip'
  50. - 'rm -rf admin'
  51. - 'mv dist admin'
  52. - 'docker exec nginx nginx -s reload'
  53. status:
  54. - success
  55. trigger:
  56. branch:
  57. - 2.0
  58. event:
  59. - push