.drone.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. - sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories
  19. - apk update
  20. - apk add zip
  21. - zip -r dist.zip dist
  22. - name: push
  23. image: appleboy/drone-scp
  24. settings:
  25. host:
  26. from_secret: TestServerIP
  27. port:
  28. from_secret: Port
  29. username: root
  30. password:
  31. from_secret: TestServerPwd
  32. command_timeout: 3m
  33. target: /opt/docker/other/nginx/html/
  34. source:
  35. - dist.zip
  36. status:
  37. - success
  38. - name: deploy
  39. image: appleboy/drone-ssh
  40. settings:
  41. host:
  42. from_secret: TestServerIP
  43. username: root
  44. password:
  45. from_secret: TestServerPwd
  46. port:
  47. from_secret: Port
  48. script:
  49. - 'cd /opt/docker/other/nginx/html'
  50. - 'unzip dist.zip'
  51. - 'rm -rf dist.zip'
  52. - 'rm -rf admin'
  53. - 'mv dist admin'
  54. - 'docker exec nginx nginx -s reload'
  55. status:
  56. - success
  57. trigger:
  58. branch:
  59. - 2.0
  60. event:
  61. - push