release (646B) - Raw
1 #!/usr/bin/env bash 2 set -euo pipefail 3 4 _err() { 5 echo >&2 "ERROR: $*" 6 exit 1 7 } 8 9 git status --porcelain | grep -q "" && 10 _err "working tree is dirty, commit your changes first." 11 12 [[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(-rc([0-9]+))?$ ]] || 13 _err "arg1 accepts the following formats: v1.0 v1.0.0 v1.0-rc1 v1.0.1-rc1" 14 15 git tag | grep -q "^$1$" && 16 _err "tag $1 already exists" 17 18 # sanity test: do the tests pass? 19 make -B -j"$(nproc)" test lint 20 21 last_tag=$(git tag | tail -1) 22 23 { 24 echo undocker "$1" 25 echo 26 echo Changelog since "$last_tag": 27 git log --pretty=format:"- [%an] %s" "$last_tag"..HEAD 28 } | git tag -F - "$1"