logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

archive-tags (796B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017-2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. workdir="$(git rev-parse --show-toplevel)"
  5. name="$(basename "${workdir}")"
  6. mkdir -p "${workdir}.archives"
  7. # https://semver.org/
  8. # printf "%s\n" 'v1.0.0' '0.1.2' 'foobar' | egrep '^v?[0-9\.]+(-[0-9A-Za-z-]*)?'
  9. git tag -l | egrep '^v?[0-9\.]+(-[0-9A-Za-z-]*)?' | while read -r tag; do
  10. version="$(echo "$tag" | sed 's/^v//')"
  11. file="${workdir}.archives/${name}-$(echo "${version}" | tr '/' '_').tar.gz"
  12. test -f "${file}" || git archive \
  13. --format tar.gz \
  14. --prefix "${name}-${version}/" \
  15. -o "${file}" \
  16. -- \
  17. "${tag}"
  18. test -f "${file}.sig" || gpg --detach-sign "${file}"
  19. test -f "${file}.sign" || minisign -S -x "${file}.sign" -m "${file}"
  20. done