@@ -9,8 +9,8 @@ if [[ "${TRAVIS_REPO_SLUG:-}" != "haskell/haskell-mode" ]]; then
9
9
exit 0
10
10
fi
11
11
12
- if [[ " ${TRAVIS_BRANCH:- } " != " master" ]]; then
13
- echo " TRAVIS_BRANCH is '${TRAVIS_BRANCH:- } ' expected 'master'"
12
+ if [[ " ${TRAVIS_BRANCH:- } " != " master" && " ${TRAVIS_BRANCH :- } " != branch- * ]]; then
13
+ echo " TRAVIS_BRANCH is '${TRAVIS_BRANCH:- } ' expected 'master' or 'branch-*' "
14
14
echo " Manual deployment available only for 'master' branch"
15
15
exit 0
16
16
fi
@@ -21,38 +21,59 @@ if [[ -z "${GITHUB_DEPLOY_KEY_PASSPHRASE:-}" ]]; then
21
21
exit 0
22
22
fi
23
23
24
- # Note: GITHUB_DEPLOY_KEY_PASSPHRASE comes from 'secure' section in .travis.yml
25
- cp haskell-mode-travis-deploy-key haskell-mode-travis-deploy-key-plain
26
- chmod 0600 haskell-mode-travis-deploy-key-plain
27
- ssh-keygen -f haskell-mode-travis-deploy-key-plain -P $GITHUB_DEPLOY_KEY_PASSPHRASE -p -N " "
24
+ if [[ ${GITHUB_DEPLOY_KEY_PASSPHRASE:- } != " skip" ]]; then
25
+ # Note: GITHUB_DEPLOY_KEY_PASSPHRASE comes from 'secure' section in .travis.yml
26
+ cp haskell-mode-travis-deploy-key haskell-mode-travis-deploy-key-plain
27
+ chmod 0600 haskell-mode-travis-deploy-key-plain
28
+ ssh-keygen -f haskell-mode-travis-deploy-key-plain -P $GITHUB_DEPLOY_KEY_PASSPHRASE -p -N " "
28
29
29
- eval $( ssh-agent)
30
- ssh-add haskell-mode-travis-deploy-key-plain
30
+ eval $( ssh-agent)
31
+ ssh-add haskell-mode-travis-deploy-key-plain
32
+ fi
31
33
32
34
# Git setup, this commit should appear as if Travis made it
33
35
export GIT_COMMITTER_EMAIL=
' [email protected] '
34
36
export GIT_COMMITTER_NAME=' Travis CI'
35
37
export GIT_AUTHOR_EMAIL=
' [email protected] '
36
38
export GIT_AUTHOR_NAME=' Travis CI'
37
39
40
+ # Documentation directory name
41
+
42
+ if [[ ${TRAVIS_BRANCH} == " master" ]]; then
43
+ DOCDIR=" latest"
44
+ else
45
+ DOCDIR=" ${TRAVIS_BRANCH// branch-/ } "
46
+ fi
47
+
38
48
HEAD_COMMIT=$( git rev-parse --short HEAD)
39
49
40
50
if [ -d gh-pages-deploy ]; then
41
51
rm -fr gh-pages-deploy
42
52
fi
43
53
44
- git clone --quiet --branch=gh-pages
" [email protected] :haskell/haskell-mode.git" gh-pages-deploy
54
+ git clone --quiet --
depth 1 -- branch=gh-pages
" [email protected] :haskell/haskell-mode.git" gh-pages-deploy
45
55
46
56
cd gh-pages-deploy
47
- git rm -qr manual/latest
48
- cp -r ../html manual/latest
49
- find manual/latest -name ' *.html' -exec sed -i -e ' /^<\/head>$/i\
57
+ if [[ -d " manual/${DOCDIR} " ]]; then
58
+ git rm -qr " manual/${DOCDIR} "
59
+ fi
60
+
61
+ cp -r ../html " manual/${DOCDIR} "
62
+ find " manual/${DOCDIR} " -name ' *.html' -exec sed -i ' ~' -e ' /^<\/head>$/i\
50
63
<script src="../../index.js"> </script>
51
64
' \{ } \;
52
- git add manual/latest
53
- (git commit -m " Update manual from haskell/haskell-mode@${HEAD_COMMIT} " && git push origin gh-pages) || true
65
+ find " manual/${DOCDIR} " -name ' *~' -exec rm \{ } \;
66
+ git add " manual/${DOCDIR} "
67
+ if [[ ${GITHUB_DEPLOY_KEY_PASSPHRASE:- } != " skip" ]]; then
68
+ (git commit -m " Update manual for '${DOCDIR} ' from haskell/haskell-mode@${HEAD_COMMIT} " && git push origin gh-pages) || true
69
+ else
70
+ echo " Update manual for '${DOCDIR} ' from haskell/haskell-mode@${HEAD_COMMIT} "
71
+ fi
54
72
cd ..
55
- rm -fr gh-pages-deploy
56
73
57
- eval $( ssh-agent -k)
74
+ if [[ ${GITHUB_DEPLOY_KEY_PASSPHRASE:- } != " skip" ]]; then
75
+ rm -fr gh-pages-deploy
76
+ eval $( ssh-agent -k)
77
+ fi
78
+
58
79
echo Done!
0 commit comments