-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
51 lines (38 loc) · 867 Bytes
/
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
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
_error() {
echo "$@" 1>&2
}
_usage() {
_error "Usage: $0 -n <VERSION>"
exit 1
}
_VERSION_NEXT=""
while getopts ":n:" o; do
case "${o}" in
n)
_VERSION_NEXT="${OPTARG}"
;;
*)
_usage
;;
esac
done
shift $((OPTIND - 1))
if [ -z "${_VERSION_NEXT}" ]; then
_usage
fi
## Update version:
sed -i -E "s/^version:([ ]+).*/version:\\1${_VERSION_NEXT}/g" package.yaml
hpack
## Update CHANGELOG.md:
git-chglog -o CHANGELOG.md --next-tag "${_VERSION_NEXT}"
## Add files:
git add package.yaml zamazingo.cabal CHANGELOG.md
## Commit:
git commit -m "chore(release): ${_VERSION_NEXT}"
## Tag:
git tag -a -m "Release ${_VERSION_NEXT}" "${_VERSION_NEXT}"
## Push:
git push --follow-tags origin main
## Release
gh release create "${_VERSION_NEXT}" --title "v${_VERSION_NEXT}" --generate-notes