| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- ---
- ################
- # SECRETS #
- ################
-
- # push_deploy_key: id_rsa from DRONE host machine
-
- ################
- # Build & Test #
- ################
-
- kind: pipeline
- name: frontend_run_tests
-
- steps:
- # Test the vue frontend
- - name: test-frontend
- image: node
- commands:
- - pwd
- - cd ./frontend
- - npm install
- - npm test
- volumes:
- # Link node_modules cache from host filesystem into container at the expected location
- - name: frontend_node_cache
- path: /drone/src/frontend/node_modules
-
- - name: build-frontend
- image: node
- commands:
- - cd ./frontend
- - rm -Rf ./build/*
- - npx browserslist@latest --update-db
- - npm run build
- - ls ./build
- environment:
- NODE_OPTIONS: --openssl-legacy-provider
- volumes:
- # Link node_modules cache from host filesystem into container at the expected location
- - name: frontend_node_cache
- path: /drone/src/frontend/node_modules
- - name: frontend_build
- path: /drone/src/frontend/build
-
- volumes:
- - name: frontend_node_cache
- host:
- path: /tmp/cache/drone/frontend/node_modules
- - name: frontend_build
- host:
- path: /tmp/cache/drone/frontend/build
- ---
- kind: pipeline
- name: backend_run_tests
-
- steps:
- # Test the vue frontend
- - name: test-backend
- image: node
- commands:
- - pwd
- - cd ./backend
- - npm install
- - npm test
- volumes:
- # Link node_modules cache from host filesystem into container at the expected location
- - name: backend_node_cache
- path: /drone/src/backend/node_modules
-
- volumes:
- - name: backend_node_cache
- host:
- path: /tmp/cache/drone/backend/node_modules
- - name: backend_build
- host:
- path: /tmp/cache/drone/backend/build
- ---
- ########################
- # Deploy to Production #
- ########################
-
- kind: pipeline
- name: deploy
- depends_on:
- # Must run after the first pipeline
- - frontend_run_tests
- - backend_run_tests
- trigger:
- status:
- # Only runs if the first pipeline was fully successful
- - success
-
- 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
-
- volumes:
- - name: frontend_node_cache
- host:
- path: /tmp/cache/drone/frontend/node_modules
- - name: frontend_build
- host:
- path: /tmp/cache/drone/frontend/build
- - name: backend_node_cache
- host:
- path: /tmp/cache/drone/backend/node_modules
|