Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto deploy for html manual #664

Merged
merged 1 commit into from
May 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ language: emacs-lisp

env:
matrix:
- EMACS=emacs23
- EMACS=emacs24
- EMACS=emacs-snapshot
- EMACS=emacs23 TARGET=check
- EMACS=emacs24 TARGET=check
- EMACS=emacs-snapshot TARGET=check
- EMACS=emacs24 TARGET=deploy-manual
global:
- secure: "ejv1+ub/v+Hm/23fhp4zLAHT3HiCG+YdDHai57LDe4LfEZCeGz4i/6LazbPbwm58v2YuKvMcdNshebc1s4A293ARJryPyFfW/8kEe+3hQ+cDxunNdHfqcS8SyhcDG0mrv7dqiVAtMJqB8qZb0c161KeEM8nyhC0wyQ+EZ5qJnzM="

matrix:
allow_failures:
Expand All @@ -27,9 +30,18 @@ install:
sudo apt-get install -qq emacs-snapshot &&
sudo apt-get install -qq emacs-snapshot-el;
fi
- if [ "$TARGET" = "deploy-manual" ]; then
curl -O http://ftp.gnu.org/gnu/texinfo/texinfo-5.2.tar.xz;
tar -xf texinfo-5.2.tar.xz;
cd texinfo-5.2;
./configure;
make;
sudo make install;
cd ..;
fi

script:
lsb_release -a && $EMACS --version && make EMACS=$EMACS check
lsb_release -a && $EMACS --version && make EMACS=$EMACS $TARGET

notifications:
email: false
Expand Down
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,41 +118,42 @@ info: haskell-mode.info dir
dir: haskell-mode.info
$(INSTALL_INFO) --dir=$@ $<

haskell-mode.info: haskell-mode.texi
haskell-mode.info: doc/haskell-mode.texi
# Check if chapter order is same as node order
@sed -n -e '/@chapter/ s/@code{\(.*\)}/\1/' \
-e 's/@chapter \(.*\)$$/* \1::/p' \
-e 's/@unnumbered \(.*\)$$/* \1::/p' \
haskell-mode.texi > haskell-mode-menu-order.txt
$< > haskell-mode-menu-order.txt
@sed -e '1,/@menu/ d' \
-e '/end menu/,$$ d' \
haskell-mode.texi > haskell-mode-content-order.txt
$< > haskell-mode-content-order.txt
diff -C 1 haskell-mode-menu-order.txt haskell-mode-content-order.txt
@rm haskell-mode-menu-order.txt haskell-mode-content-order.txt

# Processing proper
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $<

haskell-mode.html: haskell-mode.texi haskell-mode.css
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) --html --css-include=haskell-mode.css --no-split -o $@ $<
doc/haskell-mode.html: doc/haskell-mode.texi doc/haskell-mode.css
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) --html --css-include=doc/haskell-mode.css --no-split -o $@ $<

html/index.html : haskell-mode.texi
if [ -e html ]; then rm -r html; fi
doc/html/index.html : doc/haskell-mode.texi
if [ -e doc/html ]; then rm -r doc/html; fi
LANG=en_US.UTF-8 $(MAKEINFO) $(MAKEINFO_FLAGS) --html \
--css-ref=haskell-mode.css \
-c AFTER_BODY_OPEN="<div class='background'> </div>" \
-c SHOW_TITLE=0 \
-o html $<
-o doc/html $<

html/haskell-mode.css : haskell-mode.css html/index.html
doc/html/haskell-mode.css : doc/haskell-mode.css doc/html/index.html
cp $< $@

html/images/haskell-mode.svg : images/haskell-mode.svg html/index.html
mkdir -p html/images
doc/html/haskell-mode.svg : images/haskell-mode.svg doc/html/index.html
cp $< $@

html : html/index.html html/haskell-mode.css html/images/haskell-mode.svg
doc/html : doc/html/index.html doc/html/haskell-mode.css doc/html/haskell-mode.svg

deploy-manual : doc/html
cd doc && ./deploy-manual.sh

$(AUTOLOADS): $(ELFILES) haskell-mode.elc
$(BATCH) \
Expand Down
55 changes: 55 additions & 0 deletions doc/deploy-manual.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

set -e
set -u

if [[ "${TRAVIS_REPO_SLUG:-}" != "haskell/haskell-mode" ]]; then
echo "TRAVIS_REPO_SLUG is '${TRAVIS_REPO_SLUG:-}' expected 'haskell/haskell-mode'"
echo "Manual deployment available only directly for 'haskell/haskell-mode' repo"
exit 0
fi

if [[ "${TRAVIS_BRANCH:-}" != "master" ]]; then
echo "TRAVIS_BRANCH is '${TRAVIS_BRANCH:-}' expected 'master'"
echo "Manual deployment available only for 'master' branch"
exit 0
fi

if [[ -z "${GITHUB_DEPLOY_KEY_PASSPHRASE:-}" ]]; then
echo "GITHUB_DEPLOY_KEY_PASSPHRASE must be set to passphrase for github deploy key"
echo "Pull requests do not have access to secure variables"
exit 0
fi

# Note: GITHUB_DEPLOY_KEY_PASSPHRASE comes from 'secure' section in .travis.yml
cp haskell-mode-travis-deploy-key haskell-mode-travis-deploy-key-plain
chmod 0600 haskell-mode-travis-deploy-key-plain
ssh-keygen -f haskell-mode-travis-deploy-key-plain -P $GITHUB_DEPLOY_KEY_PASSPHRASE -p -N ""

eval $(ssh-agent)
ssh-add haskell-mode-travis-deploy-key-plain

# Git setup, this commit should appear as if Travis made it
export GIT_COMMITTER_EMAIL='[email protected]'
export GIT_COMMITTER_NAME='Travis CI'
export GIT_AUTHOR_EMAIL='[email protected]'
export GIT_AUTHOR_NAME='Travis CI'

HEAD_COMMIT=$(git rev-parse --short HEAD)

if [ -d gh-pages-deploy ]; then
rm -fr gh-pages-deploy
fi

git clone --quiet --branch=gh-pages "[email protected]:haskell/haskell-mode.git" gh-pages-deploy

cd gh-pages-deploy
git rm -qr manual/latest
cp -r ../html manual/latest
git add manual/latest
(git commit -m "Update manual from haskell/haskell-mode@${HEAD_COMMIT}" && git push) || true
cd ..
rm -fr gh-pages-deploy

eval $(ssh-agent -k)
echo Done!
30 changes: 30 additions & 0 deletions doc/haskell-mode-travis-deploy-key
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,9385B3F19E12C488ACF654D37A7B70B2

3ucmv5i37lwRejeFWTliQ9pfs8Vfq1G/30lnI7/GroClDiE2LAKm9tWzD8EAVdjx
lAcD9gKy9g+5Gft/qj+ucXmh2OWhTz2veBIJzjuujoZBNbbgBhBGrkAzr0h2LK5u
OE06F5Goz6rAjnyFbxTU9slZnWENHKpnwYBRriIq3KM1vS9Kr/0S3cYYfY5exITT
Gy5uTLHDVzps5Bn7wjLgXRUoLbDRRDF6L4LPkaFyEHRt+1VjtqWc3jnMuY7P2Rru
y8Mlr0cv9UzeJleTrN8AvcEtUCcl7FpieSZsGh0Q2/wEj3fEFk6Zf/q3aAqz0mn4
hdp3CvTRUeYv1JibdXSptd34dpxB+9IJIbZnZ4ixaj5Ay3oCj9PPHC+qDGsjeA6J
ect9EzxuVr6j4gvJYR0nOKNH1KOBOAZDhCQG0kvZxXaQyUbu5NV+kh6XUCedzfJZ
XyutuOF6frUjEkJlRj5aWdgtXUDKrPDO9jnV9jknoyaOQMjWt4vd8uhkWZo+SfZ8
bVO8pcx/YxNBKiHeDiLVUPc7h0Y1fI48RwLky+iLrYTe6hhMOPb8/PxZsbG+xVN5
+D2v08EhDzomxsPKBagHCb9Dffihi21F54ZeRBAx4Fr7O3KEHFE/67Oec5lz/seh
yDw+ZhW9bLklO8nZWw4rJGKG7pCgb4pRVD4Rk3VFgVdolq9Z44YNCyHX+CsfuE7D
KvHBOQWdpVD8EvP2sjqb7kIFOY9ZP5vOOZ10fm9XweCca4xJzwlr9aah0XXYza8S
hCgkPYDQndLM4NH0UfGJPft7HhjUSF7vodL/0jKsTvRBeXnh5pgeTM576LnpfYd3
wzLKg4g2/bIMUGYKo4VRY6rXvQbf4MDvUlnGRMBnihbm+x0LU6U0/nxBzeKnv5D9
VR56xGwJHxIytNjqzAZVPk8+9nXw8Dyc0XmSkPsaYr5DgI/nacRbdvlVo2M8Rac8
72qcAqkUAB/JXl4Jbucw4nGBsdOnl6zGRqTMeG/bfR9ULM4u1wGzNeXghc5+Krk3
mMiZeCxfnAdw2eEM0aXieMD2QB882Cm5HVB+7tqQZcbpr8pt9uNQrr44rkBnNsqa
LQdmbUN+1+uDXlFstkKBCN/i2cEX5NTo7yiebMZZ9/+uY1LWTPzV3wAwtJeYaMIB
oJ5DunlxqpKULX8jL0k2qAuA57ah2DlsMj/2L9uNs84ZmkPnhtPpiDwsFCL+xxRo
Sup6qrrBOP6WvGR8O4uWcKP/HH6x11cgD20NWcoSjslXBgJK5nV9uqiKE/vNjG9e
/pDfvce4kdUQcp4hbJu+o8MrWLC9o3ijPZWfqikCt5dX8qMp364GZcyxYOy0gv9X
g259f1GImJHcFMb88qqYdP9au+S96ZIXOGtlKH/nwfe/UFe9tO2jOQqNgVh+Akyu
3gcjuMyDQryXNNHMRlB76mFAUnSUQIQ3n84oMFn8ZscogDdA89FWOV0MUkSoiVmW
7uD2hlliYg269xDJH3FE4Txk95fKquJpsa+6hzpt2V7VqR6m0BzQ+yQmMFuWsLtI
oTOUtdPYojZVWPgeskNCrxEg2/CJQ4lHGQhv8tab5HWleHCS75RjwlFpYE9Ie4K3
-----END RSA PRIVATE KEY-----
2 changes: 1 addition & 1 deletion haskell-mode.css → doc/haskell-mode.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ div.background {
width: 256px;
height: 256px;
opacity: 0.3;
background-image: url("images/haskell-mode.svg");
background-image: url("haskell-mode.svg");
background-repeat: no-repeat;
background-size: 256px 256px;
}
File renamed without changes.