on 87a2553 help sign in
schematic/release
35 lines 1.1 kB history raw
1#!/bin/bash
3set -o xtrace
5dist=`stack path --dist-dir --stack-yaml ./stack.yaml 2> /dev/null`
7echo -e "\033[1;36mTesting library...\033[0m"
8stack test 2> /dev/null
10echo -e "\033[1;36mRunning sdist...\033[0m"
11cabal sdist
13echo -e "\033[1;36mGenerating documentation...\033[0m"
14stack haddock 2> /dev/null
16if [ "$?" -eq "0" ]; then
17 echo -e "\033[1;32mUploading package to Hackage...\033[0m"
18 read -p "Hackage username: " username
19 read -p "Hackage password: " -s password
20 echo ""
21 cabal upload -u $username -p $password dist/$1-$2.tar.gz
23 docdir=$dist/doc/html
24 cd $docdir
25 doc=$1-$2-docs
27 echo -e "Compressing documentation from \033[1;34m$docdir\033[0m for \033[1;35m$1\033[0m-\033[1;33m$2\033[1;30m"
28 cp -r $1 $doc
29 tar -c -v -z --format=ustar -f $doc.tar.gz $doc
30 echo -e "\033[1;32mUploading documentation to Hackage...\033[0m"
31 curl -X PUT -H 'Content-Type: application/x-tar' -H 'Content-Encoding: gzip' --data-binary "@$doc.tar.gz" "https://$username:$password@hackage.haskell.org/package/$1-$2/docs"
32 exit $?
33else
34 echo -e "\033[1;31mNot in a stack-powered project\033[0m"
35fi