~motiejus/bazel-zig-cc

bazel-zig-cc/release -rwxr-xr-x 817 bytes
90fddbcf — Motiejus Jakštys Update release notes for v0.3.3 5 hours ago
                                                                                
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
#!/bin/bash
set -xeuo pipefail

_err(){ >&2 echo "ERROR: $*"; exit 1; }

git status --porcelain | grep -q "" &&
    _err "working tree is dirty, commit your changes first."

[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]] || \
    _err "arg1 accepts the following formats: v1.0 v1.0.0"

git tag | grep -q "^$1$" &&
    _err "tag $1 already exists"

last_tag=$(git tag | tail -1)

{
    echo bazel-zig-cc "$1"
    echo
    echo Changelog since "$last_tag":
    git log --pretty=format:"- [%cn] %s" "$last_tag"..HEAD
} | git tag -u motiejus@jakstys.lt -F - "$1"

shasum=$(git archive --prefix="bazel-zig-cc-$1/" --format=tar "$1" | \
    gzip -n | sha256sum | cut -f1 -d" ")

./relnotes.awk -v tag="$1" -v sha256sum="$shasum" README.md | sponge README.md

git add README.md
git commit -m "Update release notes for $1"