From 9c78a4736039172a82ab435e2d7c4d43128eb5db Mon Sep 17 00:00:00 2001 From: Siggi Skulason Date: Thu, 8 Jul 2021 14:59:40 +0100 Subject: [PATCH] build(snap): update versioning to use git tag (#70) This commit updates the snap to set the snap version to the latest git tag version. It also creates a VERSION file for the cmake build to use. Signed-off-by: Siggi Skulason --- snap/snapcraft.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 677f9b7..41ca0d9 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -35,14 +35,11 @@ parts: source: snap/local override-pull: | cd $SNAPCRAFT_PROJECT_DIR - if [ -f VERSION ]; then - PROJECT_VERSION=$(cat VERSION) - else - PROJECT_VERSION="0.0.0" - # The cmake build requires a VERSION file - echo $PROJECT_VERSION > VERSION + GIT_VERSION=$(git describe --tags --abbrev=0 | sed 's/v//') + if [ -z "$GIT_VERSION" ]; then + GIT_VERSION="0.0.0" fi - snapcraftctl set-version ${PROJECT_VERSION} + snapcraftctl set-version ${GIT_VERSION} config: source: . plugin: dump @@ -151,6 +148,10 @@ parts: edgex-device-grove: source: . plugin: cmake + override-pull: | + snapcraftctl pull + cd $SNAPCRAFT_PROJECT_DIR + make version source-subdir: src/c after: - device-sdk-c