aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/sign-tarballs.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-07-27 12:51:36 -0300
committerEuAndreh <eu@euandre.org>2021-07-27 12:51:36 -0300
commit3bceeb4da5ec953309bbc3e61d04f078198966d2 (patch)
treec30ba0fd9485a88f45bdd91d3784630f9e9fa950 /aux/workflow/sign-tarballs.sh
parentTODOs.md: Dump links on Scratch (diff)
downloadgistatic-3bceeb4da5ec953309bbc3e61d04f078198966d2.tar.gz
gistatic-3bceeb4da5ec953309bbc3e61d04f078198966d2.tar.xz
aux/: Update, adjust Makefile
Diffstat (limited to 'aux/workflow/sign-tarballs.sh')
-rwxr-xr-xaux/workflow/sign-tarballs.sh39
1 files changed, 30 insertions, 9 deletions
diff --git a/aux/workflow/sign-tarballs.sh b/aux/workflow/sign-tarballs.sh
index 8de6ac4..295619c 100755
--- a/aux/workflow/sign-tarballs.sh
+++ b/aux/workflow/sign-tarballs.sh
@@ -1,17 +1,38 @@
#!/bin/sh
set -eu
-PROJECT="$1"
+while getopts 'n:' flag; do
+ case "$flag" in
+ n)
+ PROJECT="$OPTARG"
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND -1))
+
+assert_arg() {
+ if [ -z "$1" ]; then
+ echo "Missing $2" >&2
+ exit 2
+ fi
+}
+
+assert_arg "${PROJECT:-}" '-n PROJECT'
+
-SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)"
+SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.xz list | cut -d\ -f2)"
for tag in $(git tag); do
COMMIT="$(git rev-list -n1 "$tag")"
- if ! echo "$SIGNATURES" | grep -qF "$COMMIT"; then
- echo "Adding missing signature to $tag" >&2
- git notes --ref=refs/notes/signatures/tar.gz add -f -C "$(
- git archive --format tar.gz --prefix "$PROJECT-${tag#v}/" "$tag" |
- gpg --output - --armor --detach-sign |
- git hash-object -w --stdin
- )" "$tag"
+ if echo "$SIGNATURES" | grep -qF "$COMMIT"; then
+ continue
fi
+ echo "Adding missing signature to $tag" >&2
+ git notes --ref=refs/notes/signatures/tar.xz add -C "$(
+ git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag" |
+ gpg --output - --armor --detach-sign |
+ git hash-object -w --stdin
+ )" "$tag"
done