Skip to content

Instantly share code, notes, and snippets.

@soenkehahn
Created October 23, 2014 06:11
Show Gist options
  • Save soenkehahn/038701a58cfc0cacca57 to your computer and use it in GitHub Desktop.
Save soenkehahn/038701a58cfc0cacca57 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
cabal configure && cabal build && cabal haddock --hyperlink-source \
--html-location='/package/$pkg-$version/docs' \
--contents-location='/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="${1}-${2}-docs"
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
if [ "${CS}" -eq "0" ]; then
echo "Uploading to Hackage…"
curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" "https://hackage.haskell.org/package/${1}-${2}/docs" --user ${3} --digest
exit $?
else
echo "Error when packaging the documentation"
exit $CS
fi
else
echo "Error when trying to build the package."
exit $S
fi
@soenkehahn
Copy link
Author

What about using curl's --digest and --user to avoid sending the password over the wire in plaintext? At least I hope that's what it's doing...

CC: @Fuuzetsu, @sol

@Fuuzetsu
Copy link

I don't mind updating my own gist with whatever is needed, just let me know somehow that's not here because GitHub doesn't notify on gists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment