node.drone.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. pipeline:
  2. restore-cache:
  3. image: drillster/drone-volume-cache
  4. restore: true
  5. mount:
  6. - ./node_modules
  7. volumes:
  8. # Mount the cache volume, needs "Trusted" | https://docs.drone.io/administration/user/admins/
  9. # DRONE_USER_CREATE=username:{alicfeng},admin:true
  10. # source path {/tmp/cache/composer need to mkdir on server}
  11. - /tmp/cache/node_modules:/cache
  12. build-tests:
  13. image: node:latest
  14. commands:
  15. - node -v && npm -v
  16. - npm install -g cnpm --registry=https://registry.npm.taobao.org
  17. - cnpm install
  18. - npm run build
  19. rebuild-cache:
  20. image: drillster/drone-volume-cache
  21. rebuild: true
  22. mount:
  23. - ./node_modules
  24. volumes:
  25. - /tmp/cache/node_modules:/cache
  26. sit-deploy:
  27. image: appleboy/drone-ssh
  28. host: $host
  29. username: $username
  30. password: $password
  31. port: $port
  32. command_timeout: 300s
  33. script:
  34. # sit env deploy shell script list
  35. - cd /www/code.samego.com/
  36. - git pull
  37. - git pull
  38. - cnpm install -ddd
  39. - npm run build -ddd
  40. prod-deploy:
  41. image: appleboy/drone-ssh
  42. host: $host
  43. username: $username
  44. password: $password
  45. port: $port
  46. command_timeout: 300s
  47. script:
  48. # prod env deploy shell script list
  49. # todo awaiting extend to deploy | main scp
  50. - node -v && npm -v
  51. - cd /www/code.samego.com/
  52. - git pull
  53. - cnpm install -ddd
  54. - npm run build -ddd
  55. when:
  56. event:
  57. - push
  58. branch:
  59. - prod
  60. mail-notify:
  61. image: drillster/drone-email
  62. from: $from
  63. host: smtp.163.com
  64. username: $username
  65. password: $password
  66. port: 465
  67. subject: CICD fail notify
  68. recipients:
  69. - a@samego.com
  70. when:
  71. status: [ failure ]