-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkdocs
executable file
·24 lines (24 loc) · 1.01 KB
/
mkdocs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
cabal update && cabal install --dependencies-only
cabal configure && cabal build && cabal haddock --hyperlink-source \
--html-location='/package/$pkg-$version/docs' \
--contents-location='/package/$pkg' \
--haddock-options="--use-contents=https://hackage.haskell.org/package/${1}-${2}"
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