1

[release] add to CI

This commit is contained in:
Motiejus Jakštys 2022-04-18 12:35:14 +03:00
parent 557e75efda
commit 486a26a196
3 changed files with 25 additions and 1 deletions

View File

@ -30,3 +30,6 @@ tasks:
shellcheck -x $(awk '/#!\/bin\/(ba)?sh/&&FNR==1{print FILENAME}' $(git ls-files)) shellcheck -x $(awk '/#!\/bin\/(ba)?sh/&&FNR==1{print FILENAME}' $(git ls-files))
bazel run //:buildifier bazel run //:buildifier
git diff --exit-code git diff --exit-code
- test_release: |
cd bazel-zig-cc; . .envrc
./ci/release

18
ci/release Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -xeuo pipefail
parent_ref=$(git rev-parse HEAD)
cd "$(git rev-parse --show-toplevel)"
./release --nosign v99.0
trap "git tag -d v99.0; git reset --hard $parent_ref" EXIT
want=" 1 file changed, 2 insertions(+), 2 deletions(-)"
got=$(git show --shortstat HEAD | tail -1)
if [[ "$want" != "$got" ]]; then
echo wanted:
echo \ \ "$want"
echo got:
echo \ \ "$got"
exit 1
fi

View File

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
set -xeuo pipefail set -xeuo pipefail
sign=(-u motiejus@jakstys.lt)
[[ $1 == "--nosign" ]] && { sign=(); shift; }
_err(){ >&2 echo "ERROR: $*"; exit 1; } _err(){ >&2 echo "ERROR: $*"; exit 1; }
git status --porcelain | grep -q "" && git status --porcelain | grep -q "" &&
@ -20,7 +23,7 @@ last_tag=$(git tag | tail -1)
echo Changelog since "$last_tag": echo Changelog since "$last_tag":
git log --pretty=format:"- [%an] %s" "$last_tag"..HEAD | \ git log --pretty=format:"- [%an] %s" "$last_tag"..HEAD | \
grep -v "Update release notes for $last_tag" grep -v "Update release notes for $last_tag"
} | git tag -u motiejus@jakstys.lt -F - "$1" } | git tag "${sign[@]}" -F - "$1"
shasum=$(git archive --prefix="bazel-zig-cc-$1/" --format=tar "$1" | \ shasum=$(git archive --prefix="bazel-zig-cc-$1/" --format=tar "$1" | \
gzip -n | sha256sum | cut -f1 -d" ") gzip -n | sha256sum | cut -f1 -d" ")