undocker/release

26 lines
641 B
Plaintext
Raw Normal View History

2024-05-10 14:49:20 +03:00
#!/usr/bin/env bash
2021-08-24 13:57:30 +03:00
set -euo pipefail
_err(){ >&2 echo "ERROR: $*"; exit 1; }
2021-08-24 13:57:30 +03:00
2021-08-24 16:42:48 +03:00
git status --porcelain | grep -q "" &&
_err "working tree is dirty, commit your changes first."
2022-06-09 14:28:39 +03:00
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(-rc([0-9]+))?$ ]] || \
_err "arg1 accepts the following formats: v1.0 v1.0.0 v1.0-rc1 v1.0.1-rc1"
2021-08-24 13:57:30 +03:00
2021-08-24 16:42:48 +03:00
git tag | grep -q "^$1$" &&
_err "tag $1 already exists"
2021-08-24 13:57:30 +03:00
# sanity test: do the tests pass?
make -B -j"$(nproc)" test lint
2021-08-24 13:57:30 +03:00
last_tag=$(git tag | tail -1)
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":
2022-06-09 14:28:39 +03:00
git log --pretty=format:"- [%an] %s" "$last_tag"..HEAD
2024-05-10 14:49:45 +03:00
} | git tag -F - "$1"