Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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