archive-tags (796B)
- #!/bin/sh
- # SPDX-FileCopyrightText: 2017-2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- workdir="$(git rev-parse --show-toplevel)"
- name="$(basename "${workdir}")"
- mkdir -p "${workdir}.archives"
- # https://semver.org/
- # printf "%s\n" 'v1.0.0' '0.1.2' 'foobar' | egrep '^v?[0-9\.]+(-[0-9A-Za-z-]*)?'
- git tag -l | egrep '^v?[0-9\.]+(-[0-9A-Za-z-]*)?' | 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" || minisign -S -x "${file}.sign" -m "${file}"
- done