forked from smallhadroncollider/taskell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·83 lines (53 loc) · 2.33 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
resolver="lts-12.4"
ghcv="8.4.3"
branch=$(git rev-parse --abbrev-ref HEAD)
if [ $branch != "master" ]; then
echo "\033[0;31mMust be on master branch\033[0m"
exit
fi
if [ ! -d ".stack-work" ]; then
echo "\033[0;31mMust be run in project root\033[0m"
exit
fi
if [ -z "$1" ]; then
echo "\033[0;31mVersion number required\033[0m"
exit
fi
rm -rf .stack-work/install
# Mac
stack build --ghc-options -O3
tar -czvf "releases/$1/taskell-$1_x86-64-mac.tar.gz" --directory=".stack-work/install/x86_64-osx/$resolver/$ghcv/bin" "taskell"
# Linux
stack docker pull
stack build --docker --ghc-options -O3
tar -czvf "releases/$1/taskell-$1_x86-64-linux.tar.gz" --directory=".stack-work/install/$LINUX_DIR/$resolver/$ghcv/bin" "taskell"
mkdir -p "releases/$1/taskell/DEBIAN"
mkdir -p "releases/$1/taskell/usr/local/bin"
LINUX_DIR=$(ls .stack-work/install | grep linux)
cp ".stack-work/install/$LINUX_DIR/$resolver/$ghcv/bin/taskell" "releases/$1/taskell/usr/local/bin"
echo "Package: taskell
Version: $1
Maintainer: Mark Wales
Architecture: amd64
Description: A command line task manager written in Haskell" > "releases/$1/taskell/DEBIAN/control"
docker run -v "$PWD/releases/$1":/usr/src/app -w /usr/src/app debian dpkg-deb --build taskell
mv "releases/$1/taskell.deb" "releases/$1/taskell-$1_x86-64-linux.deb"
# Homebrew Pull Request
(cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git pull)
brew bump-formula-pr --url="https://github.com/smallhadroncollider/taskell/archive/$1.tar.gz"
(cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git add Formula/taskell.rb && git commit -m "taskell $1" && git push -f smallhadroncollider && git reset --hard origin)
open "https://github.com/Homebrew/homebrew-core/compare/master...smallhadroncollider:master"
# Release Template
rm -rf "releases/$1/taskell"
open "releases/$1"
printf "
Release Template
---------------------------------------------
- changes...
### Installation
- Mac (Homebrew): \`brew install taskell\`
- Mac/Linux: download binary and place it in a directory in your \`\$PATH\` (e.g. \`/usr/local/bin\`)
- Debian (including Ubuntu): download the \`.deb\` file and run \`dpkg -i taskell-$1_x86-64-linux.deb\`
- Fedora: Run \`sudo dnf install ncurses-compat-libs\` then download and run binary as described above
---------------------------------------------
"