Adds script for building docs.

It would be nice if stack did this automatically.
This commit is contained in:
Deni Bertovic 2016-09-07 16:45:15 +02:00
parent a97c404d98
commit 6b7c1d2a38

22
scripts/hackage-docs.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Run this script in the top-level of your package directory
# (where the .cabal file is) to compile documentation and
# upload it to hackage.
# Requirements:
# cabal-install-1.24 (for --for-hackage)
# haddock 2.17 (for the hyperlinked source)
set -e
VERSION=`grep "^version:" docker.cabal | cut -d " " -f14`
BUILDDIR=dist-newstyle/build/docker-$VERSION
DOCSDIRNAME=docker-$VERSION-docs
cabal act-as-setup -- haddock --builddir=$BUILDDIR --for-hackage --hyperlink-sources
cd $BUILDDIR/doc/html && tar --format=ustar -zcvf $DOCSDIRNAME.tar.gz $DOCSDIRNAME
echo NOW RUN: \n\n
echo cabal upload -d $BUILDDIR/doc/html/$DOCSDIRNAME.tar.gz