2021-08-24 13:57:30 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
err() {
|
|
|
|
>&2 echo "ERROR: $*"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-08-24 16:42:48 +03:00
|
|
|
git status --porcelain | grep -q "" &&
|
2021-08-24 13:57:30 +03:00
|
|
|
err "working tree is dirty, commit your changes first."
|
|
|
|
|
2021-09-01 09:38:13 +03:00
|
|
|
[[ -f sha256sum-* ]] &&
|
|
|
|
err "found artifacts from previous release, delete them first"
|
|
|
|
|
|
|
|
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]] || \
|
2021-08-24 13:57:30 +03:00
|
|
|
err "arg1 accepts the following formats: v1.0 v1.0.0"
|
|
|
|
|
2021-08-24 16:42:48 +03:00
|
|
|
git tag | grep -q "^$1$" &&
|
2021-08-24 13:57:30 +03:00
|
|
|
err "tag $1 already exists"
|
|
|
|
|
|
|
|
last_tag=$(git tag | tail -1)
|
|
|
|
|
2021-09-01 09:38:13 +03:00
|
|
|
make -B -j"$(nproc)" VSN="$1" sha256sum-asc
|
2021-08-24 13:57:30 +03:00
|
|
|
|
|
|
|
{
|
2021-08-24 16:42:48 +03:00
|
|
|
echo undocker "$1"
|
2021-08-24 13:57:30 +03:00
|
|
|
echo
|
2021-08-24 16:42:48 +03:00
|
|
|
echo Changelog since "$last_tag":
|
|
|
|
git log --pretty=format:"- [%cn] %s" "$last_tag"..HEAD
|
2021-08-24 13:57:30 +03:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo sha256sums of released binaries:
|
2021-09-01 09:38:13 +03:00
|
|
|
cat sha256sum-*.txt
|
2021-08-24 13:57:30 +03:00
|
|
|
echo
|
|
|
|
} | git tag -u motiejus@jakstys.lt -F - "$1"
|