commit: def3b9ae50f7f0cc42bfea4abfc74e9fada37fb1
parent 40fee2c7946a80f6912372574d16b63f5087bfad
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 25 Sep 2023 20:15:17 +0200
.local/bin/archive-tags: Import from utils
Diffstat:
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/.local/bin/archive-tags b/.local/bin/archive-tags
@@ -0,0 +1,28 @@
+#!/bin/sh
+workdir=$(git rev-parse --show-toplevel)
+name=$(basename ${workdir})
+
+get_minisign_pass() {
+ # `pass show` is broken…
+ # pass show minisign
+ gpg --decrypt ~/.password-store/minisign.gpg 2>/dev/null
+}
+
+mkdir -p "${workdir}.archives"
+
+minisign-rotate
+
+git tag -l | egrep '^v?[0-9]+\.' | while read -r tag; do
+ version=$(echo $tag | sed 's/^v//')
+ file="${workdir}.archives/${name}-$(echo "${version}" | tr '/' '_').tar.gz"
+
+ test -f "${file}" || git archive \
+ --format tar.gz \
+ --prefix "${name}-${version}/" \
+ -o "${file}" \
+ -- \
+ "${tag}"
+
+ #test -f "${file}.sig" || gpg --detach-sign "${file}"
+ test -f "${file}.sign" || get_minisign_pass | minisign -S -x "${file}.sign" -m "${file}"
+done