@@ -10,59 +10,78 @@ cache:
10
10
directories :
11
11
- node_modules
12
12
13
- # Custom install step so the travis scripts don 't need to be in package.json
13
+ # Custom install step so the travis-only stuff doesn 't need to be in package.json
14
14
install :
15
15
- npm install
16
- - npm install @alrra/travis-scripts@^3.0.1
16
+ - npm install @alrra/travis-scripts@^3.0.1 gh-pages@^0.12.0
17
17
18
18
# Bundle before running tests so the bundle is always up-to-date
19
19
before_script : npm run build
20
20
21
21
# This is the default, but leaving so it is obvious
22
22
# script: npm test
23
23
24
- # After a successful build create bundles & commit back to the repo
24
+ # After a successful build commit changes back to repo
25
25
after_success :
26
26
- |
27
+ # Set up SSH environment
28
+ $(npm bin)/set-up-ssh \
29
+ --key "$encrypted_8b86e0359d64_key" \
30
+ --iv "$encrypted_8b86e0359d64_iv" \
31
+ --path-encrypted-key "./.deploy.enc"
32
+
33
+ # Commit bundle changes generated in before_script step
34
+ # --commands is a weird no-op but required for commit-changes to run
35
+ # --branch arg is to ensure this only runs against the `next` branch
36
+ $(npm bin)/commit-changes \
37
+ --commands "echo committing" \
38
+ --commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
39
+ --branch "next"
27
40
28
- # Only want to commit when building a push on whatever $BRANCH is
41
+ # Only want to commit docs when building pushes on master &
42
+ # this doesn't have the built-in branch protection like commit-changes
29
43
if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
30
- [ "$TRAVIS_BRANCH" == "$BRANCH " ] && \
31
- [ "$TRAVIS_REPO_SLUG" == "$REPO " ]
44
+ [ "$TRAVIS_BRANCH" == "master " ] && \
45
+ [ "$TRAVIS_REPO_SLUG" == "lhorie/mithril.js " ]
32
46
then
33
- # Set up SSH environment
34
- $(npm bin)/set-up-ssh \
35
- --key "$encrypted_8b86e0359d64_key" \
36
- --iv "$encrypted_8b86e0359d64_iv" \
37
- --path-encrypted-key "./.deploy.enc"
47
+ # Generate docs
48
+ $(npm-bin) run gendocs
38
49
39
- # Commit changes (if there were any) from running build earlier
40
- $(npm bin)/commit-changes \
41
- --commands "echo committing" \
42
- --commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
43
- --branch "$BRANCH"
50
+ # Commit docs to gh-pages branch
51
+ # Using --add to ensure that archived versions aren't lost
52
+ # Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
53
+ $(npm bin)/gh-pages --dist ./dist --add --repo "[email protected] :lhorie/mithril.js.git"
44
54
else
45
- echo "Not submitting build artifacts "
55
+ echo "Not submitting documentation updates "
46
56
fi
47
-
57
+
48
58
# Environment configuration
49
59
env :
50
60
global :
51
- # Restrict the branch this will activate on
52
- - BRANCH=rewrite
53
- - REPO=lhorie/mithril.js
54
-
55
61
# Set up GH_USER_EMAIL & GH_USER_NAME env variables used by travis-scripts package
56
62
- secure : Xvqvm3+PvJu/rs3jl/NNn0RWLkkLkIoPHiL0GCfVRaywgjCYVN02g54NVvIDaOfybqPmu9E6PJFVs92vhF34NMFQHf4EWskynusIGV271R2BV0i+OJBfLMuLgiwm6zRn7/Zw4JvWIUGEwcnlz0qxbqdHsS0SOR3fIkFzePickW0=
57
63
- secure : Rf/ldEO9d4vItJhe6EmqWpFAyCARzoCb422nHnjr1hYJknnwIXpgyZ1C/7On/9o7rWPPf+8WcHC/rgjK2rthKCldzdG5I60LfWSNzap9lk3Aa4TpSCoDBuEp7JVvDr5tc3rKnBXVT71hOay7RSx1StWzXiJs9mjaeVMJzYzRT78=
58
64
59
- # Deploy to npm on tagged commits that successfully build
65
+ # Deploy to npm and github pages on tagged commits that successfully build
60
66
deploy :
61
- provider : npm
62
-
63
- skip_cleanup : true
64
- api_key :
65
- secure : ADElvD1oxn9GfEG7dDOggX96b36A/cGEybovAc0221CCKzv5kWCavMrtxneiJYI6N/n24abSlbM90vMfU84FEzH0Ev28dGVokRP4ad6VRkISszKlYVEP8Lds4QxfKh78jZlUxmxM0B3vmQ1kYJbTBqp3ICtaJ5ptEQHWhrLtxnc=
66
- on :
67
- tags : true
68
- repo : lhorie/mithril.js
67
+ - provider : releases
68
+ api_key :
69
+ secure : PauFuz+pn7oRpHn2JTl4k3+iWjOofyBYBvavPQVNdXgKws9mGj0i2n5k2oIDU09VD7NeyEkwP6tdLCUFNaR8uwTJH/TBXMZE95oxUEaliFreA0nOiI3WkG4NCW0GwUoIIn1yL14y6+9oEBinWUia8DIn9kZNS11DNDgQpIPnoQQ=
70
+ file :
71
+ - " mithril.js"
72
+ - " mithril.min.js"
73
+ skip_cleanup : true
74
+ on :
75
+ tags : true
76
+ repo : lhorie/mithril.js
77
+ branch : master
78
+
79
+ - provider : npm
80
+ skip_cleanup : true
81
+
82
+ api_key :
83
+ secure : ADElvD1oxn9GfEG7dDOggX96b36A/cGEybovAc0221CCKzv5kWCavMrtxneiJYI6N/n24abSlbM90vMfU84FEzH0Ev28dGVokRP4ad6VRkISszKlYVEP8Lds4QxfKh78jZlUxmxM0B3vmQ1kYJbTBqp3ICtaJ5ptEQHWhrLtxnc=
84
+ on :
85
+ tags : true
86
+ repo : lhorie/mithril.js
87
+ branch : master
0 commit comments