.drone.yml 1.2 KB

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