Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit e4e17a3

Browse files
authored
Merge pull request #348 from openforge/environments-setup
Environments Setup
2 parents 2b79881 + 3ec905b commit e4e17a3

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

.firebaserc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"projects": {
33
"default": "openforge-dev",
4-
"production": "openforge-prod"
4+
"production": "openforge-prod",
5+
"qa": "openforge-qa",
6+
"staging": "openforge-staging"
57
}
6-
}
8+
}

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ node_js:
44
branches:
55
only:
66
- develop
7+
- qa
8+
- staging
79
- master
810
before_script:
911
- npm install -g firebase-tools

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ This project uses [ButterCMS](https://buttercms.com/) as a headless content mana
144144

145145
The project also utilizes webhooks from [ButterCMS](https://buttercms.com/docs/api/?javascript#webhooks) and [Travis](https://docs.travis-ci.com/user/triggering-builds) to keep the prerendered blog content up to date. Whenever a new blog post is published, Butter's webook invokes the cloud function rebuildMaster, which relays the information to the Travis API, which in turn will trigger a rebuild and redeploy of the master branch. Butter's webhooks are managed in the ButterCMS portal.
146146

147+
148+
The branches develop, qa, staging, and master are all set up for continuous integration and deployment with Travis CI and Firebase. To deploy, create a PR for the appropriate branch, or commit and push directly (avoid this if possible).
149+
150+
If manual deployment is needed, use the following. Only do this on the develop branch, follow the PR request flow for all other branches.
151+
147152
### Featured Post
148153

149154
The featured post is managed in the ButterCMS portal. To make a post featured, it must be given a tag of 'featured'. The actual featured post will be the most recently published post with the featured tag. Currently, this post will also appear in the regular list of posts.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"prepublish": "node scripts/get-butter.js && stencil build --prod",
2222
"firebase:deploy": "node scripts/deploy.js",
2323
"firebase:deploy:dev": "firebase use default && firebase deploy --token \"$FIREBASE_TOKEN\"",
24+
"firebase:deploy:qa": "firebase use qa && firebase deploy --token \"$FIREBASE_TOKEN\"",
25+
"firebase:deploy:staging": "firebase use staging && firebase deploy --token \"$FIREBASE_TOKEN\"",
2426
"firebase:deploy:prod": "firebase use production && firebase deploy --token \"$FIREBASE_TOKEN\""
2527
},
2628
"dependencies": {

scripts/deploy.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@ function deployToFirebase(project) {
1414
console.log(stdout);
1515
console.log(stderr);
1616
});
17-
} else {
18-
exec("firebase use default && firebase deploy --token " + token, function(error, stdout, stderr) {
17+
} else if(project === 'qa') {
18+
exec("firebase use qa && firebase deploy --token " + token, function(error, stdout, stderr) {
19+
console.log(error);
20+
console.log(stdout);
21+
console.log(stderr);
22+
});
23+
} else if(project === 'staging') {
24+
exec("firebase use staging && firebase deploy --token " + token, function(error, stdout, stderr) {
25+
console.log(error);
26+
console.log(stdout);
27+
console.log(stderr);
28+
});
29+
} else if(project === 'prod') {
30+
exec("firebase use production && firebase deploy --token " + token, function(error, stdout, stderr) {
1931
console.log(error);
2032
console.log(stdout);
2133
console.log(stderr);
@@ -27,6 +39,10 @@ if (
2739
(branch == 'develop' && (!pr || pr == 'false') )
2840
) {
2941
deployToFirebase('dev');
42+
} else if (branch == 'qa' && (!pr || pr == 'false')) {
43+
deployToFirebase('qa');
44+
} else if (branch == 'staging' && (!pr || pr == 'false')) {
45+
deployToFirebase('staging');
3046
} else if (branch == 'master' && (!pr || pr == 'false')) {
3147
deployToFirebase('prod');
3248
}

0 commit comments

Comments
 (0)