@@ -9,8 +9,8 @@ if [[ "${TRAVIS_REPO_SLUG:-}" != "haskell/haskell-mode" ]]; then
99 exit 0
1010fi
1111
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-*' "
1414 echo " Manual deployment available only for 'master' branch"
1515 exit 0
1616fi
@@ -21,38 +21,59 @@ if [[ -z "${GITHUB_DEPLOY_KEY_PASSPHRASE:-}" ]]; then
2121 exit 0
2222fi
2323
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 " "
2829
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
3133
3234# Git setup, this commit should appear as if Travis made it
3335export GIT_COMMITTER_EMAIL=
' [email protected] ' 3436export GIT_COMMITTER_NAME=' Travis CI'
3537export GIT_AUTHOR_EMAIL=
' [email protected] ' 3638export GIT_AUTHOR_NAME=' Travis CI'
3739
40+ # Documentation directory name
41+
42+ if [[ ${TRAVIS_BRANCH} == " master" ]]; then
43+ DOCDIR=" latest"
44+ else
45+ DOCDIR=" ${TRAVIS_BRANCH// branch-/ } "
46+ fi
47+
3848HEAD_COMMIT=$( git rev-parse --short HEAD)
3949
4050if [ -d gh-pages-deploy ]; then
4151 rm -fr gh-pages-deploy
4252fi
4353
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
4555
4656cd 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\
5063<script src="../../index.js"> </script>
5164' \{ } \;
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
5472cd ..
55- rm -fr gh-pages-deploy
5673
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+
5879echo Done!
0 commit comments