From c629456166263a1c078cb7b12561754ebad78a84 Mon Sep 17 00:00:00 2001 From: jderose9 Date: Fri, 26 Jan 2018 21:46:49 -0500 Subject: [PATCH] pull latest version from tag in github when building #286 --- .gitignore | 2 +- Makefile | 22 ++++++++++++++-------- metadata.json | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index c422364..521746a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .~ *~ gschemas.compiled -dash-to-panel@jderose9.github.com.zip +dash-to-panel@jderose9.github.com*.zip *.mo po/dash-to-panel.pot Settings.ui.h diff --git a/Makefile b/Makefile index 033cc07..cd645d8 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,15 @@ INSTALLNAME = dash-to-panel@jderose9.github.com # The command line passed variable VERSION is used to set the version string # in the metadata and in the generated zip-file. If no VERSION is passed, the -# current commit SHA1 is used as version number in the metadata while the -# generated zip file has no string attached. +# version is pulled from the latest git tag and the current commit SHA1 is +# added to the metadata ifdef VERSION - VSTRING = _v$(VERSION) + FILESUFFIX = _v$(VERSION) else - VERSION = $(shell git rev-parse HEAD) - VSTRING = + LATEST_TAG = $(shell git describe --match "v[0-9]*" --abbrev=0 --tags HEAD) + VERSION = $(LATEST_TAG:v%=%) + COMMIT = $(shell git rev-parse HEAD) + FILESUFFIX = endif all: extension @@ -61,8 +63,8 @@ install-local: _build zip-file: _build cd _build ; \ - zip -qr "$(UUID)$(VSTRING).zip" . - mv _build/$(UUID)$(VSTRING).zip ./ + zip -qr "$(UUID)$(FILESUFFIX).zip" . + mv _build/$(UUID)$(FILESUFFIX).zip ./ -rm -fR _build _build: all @@ -81,4 +83,8 @@ _build: all mkdir -p $$lf/LC_MESSAGES; \ cp $$l $$lf/LC_MESSAGES/dash-to-panel.mo; \ done; - sed -i 's/"version": -1/"version": "$(VERSION)"/' _build/metadata.json; +ifdef COMMIT + sed -i 's/"version": [[:digit:]][[:digit:]]*/"version": $(VERSION),\n"commit": "$(COMMIT)"/' _build/metadata.json; +else + sed -i 's/"version": [[:digit:]][[:digit:]]*/"version": $(VERSION)/' _build/metadata.json; +endif diff --git a/metadata.json b/metadata.json index 031712b..294e76f 100644 --- a/metadata.json +++ b/metadata.json @@ -6,5 +6,5 @@ "shell-version": [ "3.18", "3.20", "3.22", "3.24", "3.26" ], "url": "https://github.com/jderose9/dash-to-panel", "gettext-domain": "dash-to-panel", -"version": -1 +"version": 0 }