1+ # Javascript Node CircleCI 2.0 configuration file
2+ #
3+ # Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+ #
5+ version : 2.1
6+
7+ commands :
8+ deploy-now-sh :
9+ description : " A command to deploy to now.sh."
10+ steps :
11+ - checkout
12+ - restore_cache :
13+ name : Restore Yarn Package Cache
14+ keys :
15+ - yarn-packages-{{ checksum "yarn.lock" }}
16+ - run :
17+ name : Install Dependencies
18+ command : yarn install --frozen-lockfile
19+ - save_cache :
20+ name : Save Yarn Package Cache
21+ key : yarn-packages-{{ checksum "yarn.lock" }}
22+ paths :
23+ - ~/.cache/yarn
24+ - run : yarn server build && yarn deploy
25+
26+
27+ jobs :
28+ production :
29+ docker :
30+ - image : circleci/node:8.10.0
31+ environment :
32+ STAGE : production
33+ NOW_ALIAS : https://api-prod.howtographql.now.sh
34+ working_directory : ~/repo
35+ steps :
36+ - deploy-now-sh
37+
38+ staging :
39+ docker :
40+ - image : circleci/node:8.10.0
41+ environment :
42+ STAGE : staging
43+ NOW_ALIAS : https://api-staging.howtographql.now.sh
44+ working_directory : ~/repo
45+ steps :
46+ - deploy-now-sh
47+
48+ publish-apollo :
49+ docker :
50+ # specify the version you desire here
51+ - image : circleci/node:8.10.0
52+ working_directory : ~/repo
53+ steps :
54+ - checkout
55+ - run : yarn install
56+ # Start the GraphQL server. If a different command is used to
57+ # start the server, use it in place of `npm start` here.
58+ - run :
59+ name : Starting server
60+ command : yarn server start
61+ background : true
62+ # make sure the server has enough time to start up before running
63+ # commands against it
64+ - run : sleep 5
65+ # When running on the 'master' branch, push the latest version
66+ # of the schema to Apollo Engine.
67+ - run : |
68+ yarn apollo service:push --tag="${CIRCLE_BRANCH}"
69+
70+ workflows :
71+ version : 2
72+ deploy-publish :
73+ jobs :
74+ - production :
75+ filters :
76+ branches :
77+ only :
78+ - master
79+ - staging :
80+ filters :
81+ branches :
82+ ignore :
83+ - master
84+ # - publish-apollo
0 commit comments