mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
CICD: Make Version Information SemVer Compliant.
Make the version information used throughout the application and build process compliant with the SemVer specifications, so that it can be processed with libraries. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
3c8ce37299
commit
2b7900b68d
5 changed files with 23 additions and 9 deletions
|
@ -523,6 +523,9 @@ cd "$SRC"
|
|||
|
||||
cd ${SRC_DIR}
|
||||
|
||||
# Remove a stale generated ssrf-version.h file (if any)
|
||||
rm -f ssrf-version.h
|
||||
|
||||
if [ ! -d libdivecomputer/src ] ; then
|
||||
git submodule init
|
||||
git submodule update --recursive
|
||||
|
|
|
@ -29,7 +29,7 @@ fi
|
|||
pushd "$(dirname "$0")/../" &> /dev/null
|
||||
export SUBSURFACE_SOURCE=$PWD
|
||||
|
||||
VERSION_EXTENSION="-"
|
||||
COMMITS_SINCE="0"
|
||||
|
||||
# add the build number to this as 'patch' component
|
||||
# if we run in an environment where we are given a build number (e.g. CICD builds)
|
||||
|
@ -54,22 +54,26 @@ if [ ! -f latest-subsurface-buildnumber ] ; then
|
|||
git checkout "$LAST_BUILD_BRANCH" &> /dev/null || croak "failed to check out $LAST_BUILD_BRANCH in nightly-builds"
|
||||
BUILDNR=$(<./latest-subsurface-buildnumber)
|
||||
popd &> /dev/null
|
||||
VERSION_EXTENSION+=$(git log --pretty="oneline" "${LAST_BUILD_SHA}...HEAD" | wc -l | tr -d '[:space:]')
|
||||
VERSION_EXTENSION+="-"
|
||||
[ "$VERSION_EXTENSION" = "-0-" ] && VERSION_EXTENSION="-"
|
||||
COMMITS_SINCE=$(git log --pretty="oneline" "${LAST_BUILD_SHA}...HEAD" | wc -l | tr -d '[:space:]')
|
||||
if [[ -z $COMMITS_SINCE ]]; then
|
||||
COMMITS_SINCE="0"
|
||||
fi
|
||||
else
|
||||
BUILDNR=$(<"latest-subsurface-buildnumber")
|
||||
fi
|
||||
|
||||
VERSION_EXTENSION="-"
|
||||
if [ $COMMITS_SINCE -ne 0 ]; then
|
||||
VERSION_EXTENSION+="patch.${COMMITS_SINCE}."
|
||||
fi
|
||||
|
||||
if [ -f "latest-subsurface-buildnumber-extension" ] ; then
|
||||
VERSION_EXTENSION+=$(<"latest-subsurface-buildnumber-extension")
|
||||
SUFFIX=$(<"latest-subsurface-buildnumber-extension")
|
||||
VERSION_EXTENSION+=$(sed 's/_/-/g;s/[^.a-zA-Z0-9-]//g' <<< "$SUFFIX")
|
||||
else
|
||||
VERSION_EXTENSION+="local"
|
||||
fi
|
||||
|
||||
COMMITS_SINCE=$(tr -cd "[:digit:]" <<<"$VERSION_EXTENSION")
|
||||
[[ -z $COMMITS_SINCE ]] && COMMITS_SINCE="0"
|
||||
|
||||
if [[ $DIGITS == "1" ]] ; then
|
||||
VERSION="${BUILDNR}"
|
||||
elif [[ $DIGITS == "3" ]] ; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue