Skip to content

Instantly share code, notes, and snippets.

@chessai
Created October 25, 2018 22:03
Show Gist options
  • Save chessai/f2cfbc78110c55ae60b9de41e2d9cfd8 to your computer and use it in GitHub Desktop.
Save chessai/f2cfbc78110c55ae60b9de41e2d9cfd8 to your computer and use it in GitHub Desktop.
Sometimes haddocks fail to build, even when your package builds. This script will build and upload the haddocks for you, without needing to re-upload the package or do some weird revision stuff
#!/bin/sh
set -e
dir=$(mktemp -d dist-new-docs.XXXXXX)
trap 'rm -r "$dir"' EXIT
cabal new-haddock --builddir="$dir" --haddock-for-hackage --haddock-option=--hyperlinked-source
# Starting with cabal 2.0, `--publish` is needed for uploading to non-candidate releases
cabal upload --publish -d $dir/*-docs.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment