Skip to content

Commit 8bccd06

Browse files
committed
v2 Step 5: Automatic deployment from master branch pushes and tag releases using GitHub and Travis CI
1 parent a1e91d6 commit 8bccd06

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: node_js
2+
node_js:
3+
- "node"
4+
cache:
5+
directories:
6+
- "node_modules" # This will tell Travis CI to cache the dependencies
7+
script: npm test # Here you could also run the build step of your application
8+
before_deploy: npm install now --no-save # Install Now CLI on Travis
9+
deploy:
10+
- provider: script
11+
script: npm run travis:staging
12+
skip_cleanup: true
13+
on:
14+
master: true
15+
- edge: true
16+
provider: script
17+
script: npm run travis:production
18+
skip_cleanup: true
19+
on:
20+
tags: true

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
"dev:client": "react-scripts start",
2828
"dev:server": "DEV=true PORT=8081 babel-watch ./src/server/index.js",
2929
"now-start": "node build/server/index.js",
30+
"purge": "now rm create-react-app-devops -s -y",
3031
"test": "react-scripts test --env=jsdom",
32+
"travis:purge": "now rm create-react-app-devops -s -y --token $NOW_TOKEN",
33+
"travis:production": "now --token $NOW_TOKEN && now alias --token $NOW_TOKEN && yarn travis:purge",
34+
"travis:staging": "now -A now-staging.json --token $NOW_TOKEN && now alias -A now-staging.json --token $NOW_TOKEN && yarn travis:purge",
3135
"eject": "react-scripts eject"
3236
},
3337
"proxy": {

0 commit comments

Comments
 (0)