選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

.drone.yml 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. ---
  2. ################
  3. # SECRETS #
  4. ################
  5. # push_deploy_key: id_rsa from DRONE host machine
  6. ---
  7. #################
  8. # Frontend Test #
  9. #################
  10. kind: pipeline
  11. type: docker
  12. name: frontend_run_tests
  13. steps:
  14. - name: test-frontend
  15. image: node
  16. volumes:
  17. - name: frontend_node_cache
  18. path: /drone/src/frontend/node_modules
  19. commands:
  20. - pwd
  21. - cd ./frontend
  22. - npm install
  23. - npm test
  24. volumes:
  25. - name: frontend_node_cache
  26. host:
  27. path: /tmp/cache/drone/frontend/node_modules
  28. ---
  29. #################
  30. # Backend Tests #
  31. #################
  32. kind: pipeline
  33. type: docker
  34. name: backend_run_tests
  35. steps:
  36. - name: test-backend
  37. image: node
  38. volumes:
  39. - name: backend_node_cache
  40. path: /drone/src/backend/node_modules
  41. commands:
  42. - pwd
  43. - cd ./backend
  44. - npm install
  45. - npm test
  46. volumes:
  47. - name: backend_node_cache
  48. host:
  49. path: /tmp/cache/drone/backend/node_modules
  50. ---
  51. ##################
  52. # Frontend Build #
  53. ##################
  54. kind: pipeline
  55. type: docker
  56. name: frontend_run_build
  57. depends_on:
  58. - frontend_run_tests
  59. - backend_run_tests
  60. trigger:
  61. status:
  62. - success
  63. branch:
  64. - dev
  65. steps:
  66. - name: build-frontend
  67. image: node
  68. volumes:
  69. - name: frontend_node_cache
  70. path: /drone/src/frontend/node_modules
  71. - name: frontend_build
  72. path: /drone/src/frontend/build
  73. commands:
  74. - cd ./frontend
  75. - rm -Rf ./build/*
  76. - npx browserslist@latest --update-db
  77. - npm run build
  78. - ls ./build
  79. environment:
  80. NODE_OPTIONS: --openssl-legacy-provider
  81. volumes:
  82. - name: frontend_node_cache
  83. host:
  84. path: /tmp/cache/drone/frontend/node_modules
  85. - name: frontend_build
  86. host:
  87. path: /tmp/cache/drone/frontend/build
  88. ---
  89. #####################
  90. # Deploy to Staging #
  91. #####################
  92. kind: pipeline
  93. name: deploy
  94. depends_on:
  95. # Must run after the first pipeline
  96. - frontend_run_build
  97. - backend_run_build
  98. trigger:
  99. status:
  100. # Only runs if the first pipeline was fully successful
  101. - success
  102. # Only runs on the master branch
  103. branch:
  104. - master
  105. steps:
  106. # post-receive hook
  107. - name: push commit
  108. image: appleboy/drone-git-push:0.2.0-linux-amd64
  109. settings:
  110. branch: master
  111. remote: maeda@165.232.128.85:/opt/staging/siimee.git
  112. remote_name: staging
  113. force: true
  114. ssh_key:
  115. # !: id_rsa from DRONE machine
  116. from_secret: push_deploy_key