mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +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
2
.github/actions/manage-version/action.yml
vendored
2
.github/actions/manage-version/action.yml
vendored
|
@ -37,7 +37,7 @@ runs:
|
|||
PULL_REQUEST_BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "pull-request-$PULL_REQUEST_BRANCH" > latest-subsurface-buildnumber-extension
|
||||
echo "pull-request.$PULL_REQUEST_BRANCH" > latest-subsurface-buildnumber-extension
|
||||
|
||||
- name: store version number for the build
|
||||
id: version_number
|
||||
|
|
|
@ -408,6 +408,9 @@ fi
|
|||
# now build the Subsurface aab
|
||||
make apk
|
||||
|
||||
# Clean up the generated ssrf-version.h file
|
||||
rm -f ssrf-version.h
|
||||
|
||||
popd
|
||||
|
||||
APK=$(find . -name Subsurface-mobile.apk)
|
||||
|
|
|
@ -352,5 +352,9 @@ for BUILD_NOW in $BUILD_LOOP; do
|
|||
# it appears that a first make fails with a missing generated file, which a second
|
||||
# invocation of make will happily build
|
||||
make || make
|
||||
|
||||
# Clean up the generated ssrf-version.h file
|
||||
rm -f "$SUBSURFACE_SOURCE"/ssrf-version.h .
|
||||
|
||||
popd
|
||||
done
|
||||
|
|
|
@ -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…
Reference in a new issue