TRAVIS: automatic gh-pages pushing
This commit is contained in:
parent
bb590a7692
commit
741c510b91
@ -19,6 +19,10 @@ matrix:
|
|||||||
allow_failures:
|
allow_failures:
|
||||||
- env: CABALVER=head GHCVER=head
|
- env: CABALVER=head GHCVER=head
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- secure: q++z4DGwOHYjmed00oxMnGhBTzOBzKYunXvVcnCEmvmzW3qZERtXj3B7CLW4vRtmBlo3SiM0fb25NeYao+ByzTjo8jk9noiBVZvffwRmlKCeVwYx7T4/rsDhfV97k2JOeahBSgxWNuTkt+5gv07HpKdTiIxJsiv/QdBxQeq6/Ly6dyRskmCt+VuFvQg+cqPMugxIXtY6F7eZ1zgl/LxlamWjO3E4lX0Myf4o8+SU1HRDVkkVe+ytnRcVcYI2FHuFV/sSoDMTweXQToA9roVjOkfhq4rGlPCuXJkBPyZW2otLXgAV7I2kjwgxqmS5Yw752CcFjMMbG6R1u8sEAcGrJNKHfx8sKqBwI0AVoq4CJn+nKSElTDl0KI1mqazmazK4/mddkD9NGIVXCFmw4b+YGf1uDj8FAR94UmOiEFkEObGkQxG1XK/uzDaUJ1tO3MYXjPPEIE89BJORo+ZskmKFEoqbrBR/vEjbXxJHWP7SaaoM+mWpMiSssEFb/Z5mDBFPb2P/2f7nO4ZDfOYp/9hZdBvDaVM8FmTQfzF6jIUIOFmeeiSZWIBAHoDfdZDRrM/hC5JzqfMumW9frwllsQtYytkAsUqlNnCW86jlc5/5L6D8eY2NERFI2DRqrBi7bP2AfYXsozY0gMO1RL5+iQSQVKlPhk6IyAJYCWCYnrA+dz4=
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
||||||
|
|
||||||
@ -34,6 +38,7 @@ script:
|
|||||||
- cabal test
|
- cabal test
|
||||||
- cabal check
|
- cabal check
|
||||||
- cabal sdist
|
- cabal sdist
|
||||||
|
- cabal haddock --hyperlink-source --html-location=https://hackage.haskell.org/package/\$pkg-\$version/docs/
|
||||||
# check that the generated source-distribution can be built & installed
|
# check that the generated source-distribution can be built & installed
|
||||||
- export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
|
- export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
|
||||||
cd dist/;
|
cd dist/;
|
||||||
@ -45,6 +50,9 @@ script:
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
- ./update-gh-pages.sh
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
- hasufell@posteo.de
|
- hasufell@posteo.de
|
||||||
|
51
update-gh-pages.sh
Normal file
51
update-gh-pages.sh
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SOURCE_BRANCH="master"
|
||||||
|
TARGET_BRANCH="gh-pages"
|
||||||
|
REPO="https://${GH_TOKEN}@github.com/hasufell/hpath"
|
||||||
|
DOC_LOCATION="/dist/doc/html/hpath"
|
||||||
|
|
||||||
|
|
||||||
|
# Pull requests and commits to other branches shouldn't try to deploy,
|
||||||
|
# just build to verify
|
||||||
|
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
|
||||||
|
echo "Skipping docs deploy."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cd "$HOME"
|
||||||
|
git config --global user.email "travis@travis-ci.org"
|
||||||
|
git config --global user.name "travis-ci"
|
||||||
|
git clone --branch=${TARGET_BRANCH} ${REPO} ${TARGET_BRANCH} || exit 1
|
||||||
|
|
||||||
|
# If there are no changes to the compiled out (e.g. this is a README update)
|
||||||
|
# then just bail.
|
||||||
|
if [ -z `git diff --exit-code` ]; then
|
||||||
|
echo "No changes to the output on this push; exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# docs
|
||||||
|
cd ${TARGET_BRANCH} || exit 1
|
||||||
|
echo "Removing old docs."
|
||||||
|
git rm -rf .
|
||||||
|
echo "Adding new docs."
|
||||||
|
cp -rf "${TRAVIS_BUILD_DIR}${DOC_LOCATION}"/* . || exit 1
|
||||||
|
git add *
|
||||||
|
|
||||||
|
if [[ -e ./index.html ]] ; then
|
||||||
|
echo "Commiting docs."
|
||||||
|
git commit -m "Lastest docs updated
|
||||||
|
|
||||||
|
travis build: $TRAVIS_BUILD_NUMBER
|
||||||
|
commit: $TRAVIS_COMMIT
|
||||||
|
auto-pushed to gh-pages"
|
||||||
|
|
||||||
|
git push origin $TARGET_BRANCH
|
||||||
|
echo "Published docs to gh-pages."
|
||||||
|
else
|
||||||
|
echo "Error docs are empty."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user