commit: 3ec0fa107be7fcfc48e7bdfbd93df8db0cfa1b1d
parent c559884b323d53fa10058598ed4be7ed930295ee
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 16 Sep 2023 05:54:29 +0200
sh/archive-tags: Handle tags without leading v
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sh/archive-tags b/sh/archive-tags
@@ -1,11 +1,13 @@
#!/bin/sh
-# SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
+# 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"
-git tag -l | grep '^v' | while read -r tag; do
+# 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"