1- # Javascript Node CircleCI 2.0 configuration file
2- #
3- # Check https://circleci.com/docs/2.0/language-javascript/ for more details
4- #
1+ aliases :
2+ - &restore_cache
3+ name : Restore Yarn Package Cache
4+ keys :
5+ - yarn-packages-{{ checksum "yarn.lock" }}
6+
7+ - &install_dependencies
8+ name : Install Dependencies
9+ command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
10+
11+ - &save_cache
12+ name : Save Yarn Package Cache
13+ key : yarn-packages-{{ checksum "yarn.lock" }}
14+ paths :
15+ - ~/.cache/yarn
16+
17+ - &build |
18+ yarn build
19+
20+ docker : &docker
21+ docker :
22+ - image : circleci/node:10.12.0
23+
24+ defaults : &defaults
25+ << : *docker
26+ parallelism : 1
27+ working_directory : ~/repo
28+
529version : 2
630jobs :
7- deploy-dev :
8- docker :
9- - image : circleci/node:10.12.0
10- parallelism : 1
11- working_directory : ~/repo
31+ deploy-staging :
32+ << : *defaults
1233 steps :
1334 - checkout
14- - restore_cache :
15- name : Restore Yarn Package Cache
16- keys :
17- - yarn-packages-{{ checksum "yarn.lock" }}
18- - run :
19- name : Install Dependencies
20- command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
21- - save_cache :
22- name : Save Yarn Package Cache
23- key : yarn-packages-{{ checksum "yarn.lock" }}
24- paths :
25- - ~/.cache/yarn
26- - run : yarn build
35+ - restore_cache : *restore_cache
36+ - run : *install_dependencies
37+ - save_cache : *save_cache
38+ - run : *build
2739 - run :
2840 name : Deploy to hosting
29- # Package dist folder
30- # Do some hacks to be able to copy file without ssh key (only with user/password). That's not needed for normal hosting
31- # Copy package to tmp folder
32- # On remote host:
33- # - remove public folder contents
34- # - unpack bundle archive into public folder
35- # - remove bundle archive
3641 command : |
3742 tar -czf dist.tar.gz ~/repo/dist -C ~/repo/dist .
3843 sudo apt install sshpass
@@ -44,42 +49,23 @@ jobs:
4449 rm -f ~/tmp/dist.tar.gz
4550 EOF
4651
47- deploy-prod :
48- docker :
49- - image : circleci/node:10.12.0
50- parallelism : 1
51- working_directory : ~/repo
52+ deploy-production :
53+ << : *defaults
5254 steps :
5355 - checkout
54- - - run :
55- name : Add variables for Yandex Metrics and Drift live chat
56- command :
57- echo "VUE_APP_YANDEX_METRICS_KEY=$YANDEX_METRICS_KEY" >> .env.production.local &&
58- echo "VUE_APP_DRIFT_KEY=$DRIFT_KEY" >> .env.production.local
59- - restore_cache :
60- name : Restore Yarn Package Cache
61- keys :
62- - yarn-packages-{{ checksum "yarn.lock" }}
6356 - run :
64- name : Install Dependencies
65- command : yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
66- - save_cache :
67- name : Save Yarn Package Cache
68- key : yarn-packages-{{ checksum "yarn.lock" }}
69- paths :
70- - ~/.cache/yarn
71- - run : yarn build
57+ name : Add variables for Yandex Metrics and Drift live chat
58+ command :
59+ echo "VUE_APP_YANDEX_METRICS_KEY=$YANDEX_METRICS_KEY" >> .env.production.local &&
60+ echo "VUE_APP_DRIFT_KEY=$DRIFT_KEY" >> .env.production.local
61+ - restore_cache : *restore_cache
62+ - run : *install_dependencies
63+ - save_cache : *save_cache
64+ - run : * build
7265 - run :
7366 name : Deploy to hosting
7467 environment :
7568 DEPLOY_PATH : /var/www/html/vuestic-admin
76- # Package dist folder
77- # Do some hacks to be able to copy file without ssh key (only with user/password). That's not needed for normal hosting
78- # Copy package to tmp folder
79- # On remote host:
80- # - remove public folder contents
81- # - unpack bundle archive into public folder
82- # - remove bundle archive
8369 command : |
8470 tar -czf dist.tar.gz ~/repo/dist -C ~/repo/dist .
8571 sudo apt install sshpass
@@ -96,13 +82,12 @@ workflows:
9682 version : 2
9783 build-and-deploy :
9884 jobs :
99- - deploy-dev :
85+ - deploy-staging :
10086 filters :
10187 branches :
10288 only : develop
103- - deploy-prod :
104- context : vuestic-prod
89+ - deploy-production :
90+ context : vuestic-production
10591 filters :
10692 branches :
10793 only : master
108-
0 commit comments