--- ################ # SECRETS # ################ # push_deploy_key: id_rsa from DRONE host machine --- ################# # Frontend Test # ################# kind: pipeline type: docker name: frontend_run_tests steps: - name: test-frontend image: node volumes: - name: frontend_node_cache path: /drone/src/frontend/node_modules commands: - pwd - cd ./frontend - npm install - npm test volumes: - name: frontend_node_cache host: path: /tmp/cache/drone/frontend/node_modules --- ################# # Backend Tests # ################# kind: pipeline type: docker name: backend_run_tests steps: - name: test-backend image: node volumes: - name: backend_node_cache path: /drone/src/backend/node_modules commands: - pwd - cd ./backend - npm install - npm test volumes: - name: backend_node_cache host: path: /tmp/cache/drone/backend/node_modules --- ################## # Frontend Build # ################## kind: pipeline type: docker name: frontend_run_build depends_on: - frontend_run_tests - backend_run_tests trigger: status: - success branch: - dev steps: - name: build-frontend image: node volumes: - name: frontend_node_cache path: /drone/src/frontend/node_modules - name: frontend_build path: /drone/src/frontend/build commands: - cd ./frontend - rm -Rf ./build/* - npx browserslist@latest --update-db - npm run build - ls ./build environment: NODE_OPTIONS: --openssl-legacy-provider volumes: - name: frontend_node_cache host: path: /tmp/cache/drone/frontend/node_modules - name: frontend_build host: path: /tmp/cache/drone/frontend/build --- ##################### # Deploy to Staging # ##################### kind: pipeline name: deploy depends_on: # Must run after the first pipeline - frontend_run_build - backend_run_build trigger: status: # Only runs if the first pipeline was fully successful - success # Only runs on the master branch branch: - master steps: # post-receive hook - name: push commit image: appleboy/drone-git-push:0.2.0-linux-amd64 settings: branch: master remote: maeda@165.232.128.85:/opt/staging/siimee.git remote_name: staging force: true ssh_key: # !: id_rsa from DRONE machine from_secret: push_deploy_key