add release note updater
This commit is contained in:
parent
2f0da66949
commit
02a177b20c
14
release
14
release
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -xeuo pipefail
|
||||||
|
|
||||||
_err(){ >&2 echo "ERROR: $*"; exit 1; }
|
_err(){ >&2 echo "ERROR: $*"; exit 1; }
|
||||||
|
|
||||||
git status --porcelain | grep -q "" &&
|
git status --porcelain | grep -q "" &&
|
||||||
_err "working tree is dirty, commit your changes first."
|
_err "working tree is dirty, commit your changes first."
|
||||||
|
|
||||||
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]] || \
|
[[ "$1" =~ ^([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]] || \
|
||||||
_err "arg1 accepts the following formats: v1.0 v1.0.0"
|
_err "arg1 accepts the following formats: 1.0 1.0.0"
|
||||||
|
|
||||||
git tag | grep -q "^$1$" &&
|
git tag | grep -q "^$1$" &&
|
||||||
_err "tag $1 already exists"
|
_err "tag $1 already exists"
|
||||||
@ -20,3 +20,11 @@ last_tag=$(git tag | tail -1)
|
|||||||
echo Changelog since "$last_tag":
|
echo Changelog since "$last_tag":
|
||||||
git log --pretty=format:"- [%cn] %s" "$last_tag"..HEAD
|
git log --pretty=format:"- [%cn] %s" "$last_tag"..HEAD
|
||||||
} | git tag -u motiejus@jakstys.lt -F - "$1"
|
} | 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"
|
||||||
|
34
relnotes.awk
Executable file
34
relnotes.awk
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/awk -f
|
||||||
|
|
||||||
|
BEGIN {stage=0};
|
||||||
|
|
||||||
|
!/```/ && stage==0 {
|
||||||
|
print
|
||||||
|
}
|
||||||
|
|
||||||
|
/```/ && stage==0 {
|
||||||
|
print "```"
|
||||||
|
print "BAZEL_ZIG_CC_VERSION = \""tag"\""
|
||||||
|
print ""
|
||||||
|
print "http_archive("
|
||||||
|
print " name = \"bazel-zig-cc\","
|
||||||
|
print " sha256 = \""sha256sum"\","
|
||||||
|
print " strip_prefix = \"bazel-zig-cc-{}\".format(BAZEL_ZIG_CC_VERSION),"
|
||||||
|
print " urls = [\"https://git.sr.ht/~motiejus/bazel-zig-cc/archive/{}.tar.gz\".format(BAZEL_ZIG_CC_VERSION)],"
|
||||||
|
print ")"
|
||||||
|
stage=1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
!/^)$/ && stage==1 {
|
||||||
|
next
|
||||||
|
};
|
||||||
|
|
||||||
|
/^)$/ && stage==1 {
|
||||||
|
stage=2
|
||||||
|
next
|
||||||
|
};
|
||||||
|
|
||||||
|
stage==2 {
|
||||||
|
print;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user