-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathrelease.sh
executable file
·41 lines (31 loc) · 1.04 KB
/
release.sh
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
#!/bin/bash
set -e
set -x
version=$1
# ensure there are no uncommitted changes
[ "" == "$(git status --porcelain)" ]
# update the version in sv2v.cabal
sed -i.bak -e "s/^version.*/version: $version/" sv2v.cabal
diff sv2v.cabal{,.bak} && echo not changed && exit 1 || true
rm sv2v.cabal.bak
# update the version in CHANGELOG.md
sed -i.bak -e "s/^## Unreleased$/## v$version/" CHANGELOG.md
diff CHANGELOG.md{,.bak} && echo not changed && exit 1 || true
rm CHANGELOG.md.bak
# create the release commit and tag
git commit -a -m "release v$version"
git tag -a v$version HEAD -m "Release v$version"
# build and test
make
make test
[ $version == `bin/sv2v --numeric-version` ]
# push the release commit and tag
git push
git push origin v$version
# create the GitHub release
notes=`pandoc --from markdown --to markdown --wrap none CHANGELOG.md | \
sed '3,/^## /!d' | \
tac | tail -n +3 | tac`
gh release create v$version --title v$version --notes "$notes"
# create the Hackage release candidate
stack upload --test-tarball --candidate --pvp-bounds upper .