1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Improve Makefile to better set version number

* Add --always to git describe to also return if we are run
   on a shallow clone in a git hub action with action/checkout.
This commit is contained in:
Bernhard Reiter 2022-06-01 09:56:37 +02:00
parent dca6f2c5c4
commit 89edf94cee
No known key found for this signature in database
GPG key ID: 2B7BA3BF9BC3A554

View file

@ -42,8 +42,9 @@ tag_checked_out:
# any commit after a tag is considered newer than the semver from the tag
# without an optional 'v'
# Note we need `--tags` because github release only creates lightweight tags
# (see feature request https://github.com/github/feedback/discussions/4924)
GITDESC := $(shell git describe --tags)
# (see feature request https://github.com/github/feedback/discussions/4924).
# We use `--always` in case of being run as github action with shallow clone.
GITDESC := $(shell git describe --tags --always)
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/')
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
# Hint: The regexp in the next line only matches if there is a hyphen (`-`)