You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ra...@apache.org on 2020/02/05 08:42:23 UTC
[incubator-annotator] 01/02: Add -incubating and -rc to dists
This is an automated email from the ASF dual-hosted git repository.
randall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit 3fdb62f191c8c60dcc65fd7bd722e24deec0bab0
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Sat Feb 1 16:09:38 2020 -0800
Add -incubating and -rc to dists
---
Makefile | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index 9967e05..1ea7352 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,41 @@
# License for the specific language governing permissions and limitations under
# the License.
-ANNOTATOR_VERSION := $(shell jq -r .version < lerna.json)
+# Determine the version identifier from lerna.json or git.
+
+# Are we in a release?
+in_release = $(shell if [ ! -d .git ]; then echo true; fi)
+
+ifeq ($(in_release), true)
+
+# Get the version information from lerna.json.
+annotator_vsn = $(shell jq -r .version < lerna.json)
+
+else
+
+# Get the version information from git.
+
+# What is the prerelease version?
+vsn_pre = $(shell git describe --tags --always --first-parent \
+ | grep -Eo -- '(-rc\.[0-9]+)?$$' \
+ 2>/dev/null)
+
+# What is the release version?
+vsn_rel = $(shell git describe --tags --always --first-parent \
+ | grep -Eo -- '^v[0-9]+\.[0-9]\.[0-9]+' \
+ | tail -c +2 \
+ 2>/dev/null)
+
+# Is this a tagged release?
+vsn_tag = $(shell git describe --tags --always --first-parent \
+ | grep -Eo -- '^v[0-9]+\.[0-9]\.[0-9]+(-rc.[0-9]+)?$$' \
+ | tail -c +2 \
+ 2>/dev/null)
+
+annotator_vsn = $(vsn_rel)
+
+endif
+
.PHONY: all
all: build
@@ -23,16 +57,26 @@ build:
clean:
@yarn run clean
+ifeq ($(vsn_tag),)
+
+.PHONY: dist
+dist:
+ $(error No tag found for release)
+
+else
+
.PHONY: dist
dist:
- @rm -rf apache-annotator-$(ANNOTATOR_VERSION)
+ @rm -rf apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating
@git archive \
- --output apache-annotator-$(ANNOTATOR_VERSION).tar.gz \
- --prefix apache-annotator-$(ANNOTATOR_VERSION)/ \
- HEAD
- @gpg -ab apache-annotator-$(ANNOTATOR_VERSION).tar.gz
- @sha256sum apache-annotator-$(ANNOTATOR_VERSION).tar.gz \
- > apache-annotator-$(ANNOTATOR_VERSION).tar.gz.sha256
- @sha512sum apache-annotator-$(ANNOTATOR_VERSION).tar.gz \
- > apache-annotator-$(ANNOTATOR_VERSION).tar.gz.sha512
- @echo "Done: apache-annotator-$(ANNOTATOR_VERSION).tar.gz"
+ --output apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz \
+ --prefix apache-annotator-$(annotator_vsn)-incubating/ \
+ HEAD
+ @gpg -ab apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz
+ @sha256sum apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz \
+ > apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz.sha256
+ @sha512sum apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz \
+ > apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz.sha512
+ @echo "Done: apache-annotator-$(annotator_vsn)$(vsn_pre)-incubating.tar.gz"
+
+endif