File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change
1
+ sudo : false
2
+
3
+ branches :
4
+ only :
5
+ - master
6
+
7
+ language : node_js
8
+ node_js : " 8"
9
+
10
+ script :
11
+ - git config --local user.name "Travis CI" && npm run deploy
Original file line number Diff line number Diff line change 6
6
7
7
const sh = require ( "shelljs" )
8
8
const version = require ( "../package.json" ) . version
9
+ const ATOKEN = process . env . ATOKEN //eslint-disable-line no-process-env
9
10
10
11
//------------------------------------------------------------------------------
11
12
// Helpers
@@ -46,16 +47,30 @@ function exec(command) {
46
47
// Main
47
48
//------------------------------------------------------------------------------
48
49
50
+ // Build.
49
51
exec ( `git checkout v${ version } ` )
50
52
exec ( "npm run build" )
53
+
54
+ // Load gh-pages.
55
+ if ( ATOKEN ) {
56
+ exec ( "git fetch --depth=1 https://github.com/mysticatea/vue-eslint-demo.git gh-pages:gh-pages" )
57
+ }
51
58
exec ( "git checkout gh-pages" )
52
59
53
- if ( String ( sh . cat ( "dist/versions.json" ) ) !== String ( sh . cat ( "versions.json" ) ) ) {
60
+ // Check versions.
61
+ const oldVersions = String ( sh . cat ( "versions.json" ) )
62
+ const newVersions = String ( sh . cat ( "dist/versions.json" ) )
63
+ sh . echo ( `OLD: ${ oldVersions } ` )
64
+ sh . echo ( `NEW: ${ newVersions } ` )
65
+
66
+ // Deploy.
67
+ if ( newVersions !== oldVersions ) {
54
68
rm ( "-rf" , "vs" , "index.*" )
55
69
cp ( "-r" , "dist/*" , "." )
56
70
exec ( "git add -A" )
57
71
exec ( "git commit -m \"Update: website\"" )
58
- exec ( " git push" )
72
+ exec ( ` git push${ ATOKEN ? ` https://mysticatea: ${ ATOKEN } @github.com/mysticatea/vue-eslint-demo.git gh-pages:gh-pages` : "" } ` )
59
73
}
60
74
75
+ // Back to master.
61
76
exec ( "git checkout master" )
You can’t perform that action at this time.
0 commit comments