@@ -35,39 +35,45 @@ jobs: # a collection of steps
35
35
- store_artifacts :
36
36
path : ~/tmp/reports/eslint
37
37
38
- version : # version the project
38
+ build_without_version : # build the project - requires dependencies to have been installed
39
39
executor : node-project
40
40
steps :
41
41
- checkout
42
42
- restore_cache :
43
43
key : dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
44
- - run :
45
- name : Add Git User details
46
- command : |
47
- git config --global user.email "ripixel+ci@gmail.com"
48
- git config --global user.name "CircleCi"
49
- - run :
50
- name : Bump version and generate changelog
51
- command : npm run release:ci
52
- - save_cache : # special step to save the changelog
44
+ - restore_cache :
53
45
key : changelog-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
46
+ - run : # run build
47
+ name : Build
48
+ command : npm run build
49
+ - store_artifacts : # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
50
+ path : public
51
+ prefix : public
52
+ - save_cache : # special step to save the public cache and deploy files
53
+ key : deploy-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
54
54
paths :
55
- - ~/tmp/CHANGELOG.md
55
+ - ~/tmp/public
56
+ - ~/tmp/.firebaserc
57
+ - ~/tmp/firebase.json
56
58
- ~/tmp/package-lock.json
57
- - ~/tmp/package.json
58
59
59
- build : # build the project - requires dependencies to have been installed
60
+ build_and_version :
60
61
executor : node-project
61
62
steps :
62
63
- checkout
63
64
- restore_cache :
64
65
key : dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
65
- - restore_cache :
66
- key : changelog-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
66
+ - run :
67
+ name : Add Git User details
68
+ command : |
69
+ git config --global user.email "ripixel+ci@gmail.com"
70
+ git config --global user.name "CircleCi"
71
+ - run :
72
+ name : Bump version and generate changelog
73
+ command : npm run release:ci
67
74
- run : # run build
68
75
name : Build
69
- command : |
70
- npm run build
76
+ command : npm run build
71
77
- store_artifacts : # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
72
78
path : public
73
79
prefix : public
@@ -79,16 +85,27 @@ jobs: # a collection of steps
79
85
- ~/tmp/firebase.json
80
86
- ~/tmp/package-lock.json
81
87
82
- deploy_to_firebase : # deploy the project to prod - SHOULD ONLY BE RUN ON MASTER BRANCH
88
+ deploy_to_firebase_prod : # deploy the project to prod - SHOULD ONLY BE RUN ON MASTER BRANCH
89
+ executor : node-project
90
+ steps :
91
+ - restore_cache : # restore the /public folder and associated deploy files
92
+ key : deploy-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
93
+ - restore_cache : # special step to restore the dependency cache
94
+ key : dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
95
+ - run :
96
+ name : Deploy to Firebase Production Hosting
97
+ command : ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN" --only hosting:production
98
+
99
+ deploy_to_firebase_stg : # deploy the project to staging - SHOULD ONLY BE RUN ON STAGING BRANCH
83
100
executor : node-project
84
101
steps :
85
102
- restore_cache : # restore the /public folder and associated deploy files
86
103
key : deploy-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
87
104
- restore_cache : # special step to restore the dependency cache
88
105
key : dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
89
106
- run :
90
- name : Deploy to Firebase Hosting
91
- command : ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
107
+ name : Deploy to Firebase Staging Hosting
108
+ command : ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN" --only hosting:staging
92
109
93
110
workflows :
94
111
version : 2
@@ -98,21 +115,28 @@ workflows:
98
115
- lint :
99
116
requires :
100
117
- install_deps
101
- - version :
118
+ - build_without_version :
119
+ filters :
120
+ branches :
121
+ ignore : master
122
+ requires :
123
+ - install_deps
124
+ - build_and_version :
102
125
filters :
103
126
branches :
104
127
only : master
105
128
requires :
129
+ - install_deps
106
130
- lint
107
- - build :
131
+ - deploy_to_firebase_prod :
108
132
filters :
109
133
branches :
110
134
only : master
111
135
requires :
112
- - version
113
- - deploy_to_firebase :
136
+ - build_and_version
137
+ - deploy_to_firebase_stg :
114
138
filters :
115
139
branches :
116
- only : master
140
+ only : staging
117
141
requires :
118
- - build
142
+ - build_without_version
0 commit comments