logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

archive-tags (538B)


  1. #!/bin/sh
  2. workdir="$(git rev-parse --show-toplevel)"
  3. name="$(basename "${workdir}")"
  4. mkdir -p "${workdir}.archives"
  5. git tag -l | grep '^v' | while read -r tag; do
  6. version="$(echo "$tag" | sed 's/^v//')"
  7. file="${workdir}.archives/${name}-$(echo "${version}" | tr '/' '_').tar.gz"
  8. test -f "${file}" || git archive \
  9. --format tar.gz \
  10. --prefix "${name}-${version}/" \
  11. -o "${file}" \
  12. -- \
  13. "${tag}"
  14. test -f "${file}.sig" || gpg --detach-sign "${file}"
  15. test -f "${file}.sign" || minisign -S -x "${file}.sign" -m "${file}"
  16. done