Przeglądaj źródła

Added version operability for `git archive` tarball (non git repo)

max furman 7 lat temu
rodzic
commit
c23eb88a4f
6 zmienionych plików z 31 dodań i 19 usunięć
  1. 1 0
      .VERSION
  2. 1 0
      .gitattributes
  3. 7 0
      .version.sh
  4. 2 2
      Gopkg.lock
  5. 18 15
      Makefile
  6. 2 2
      debian/changelog

+ 1 - 0
.VERSION

@@ -0,0 +1 @@
+$Format:%d$

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+.VERSION export-subst

+ 7 - 0
.version.sh

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+read -r firstline < .VERSION
+last_half="${firstline##*tag: }"
+if [[ ${last_half::1} == "v" ]]; then
+    version_string="${last_half%%[,)]*}"
+fi
+echo "${version_string:-v0.0.0}"

+ 2 - 2
Gopkg.lock

@@ -277,7 +277,7 @@
 
 [[projects]]
   branch = "master"
-  digest = "1:17d4424defbc718315d61e296841867ff76b3e03a941b41fdddbae11a7d47746"
+  digest = "1:a11fa27b1cebc2aa3650bd2086aeadf1e2aaf1f4b646895893b80260b17a19d2"
   name = "github.com/smallstep/cli"
   packages = [
     "command",
@@ -298,7 +298,7 @@
     "utils",
   ]
   pruneopts = "UT"
-  revision = "fe87ac01926afb1a518a98d4768fded646bddce1"
+  revision = "68ac9850f47f4cfe0045f1444f3f23404e2237ba"
 
 [[projects]]
   branch = "master"

+ 18 - 15
Makefile

@@ -11,7 +11,7 @@ OUTPUT_ROOT=output/
 # Set shell to bash for `echo -e`
 SHELL := /bin/bash
 
-all: build lint test
+all: build test lint
 
 .PHONY: all
 
@@ -49,6 +49,9 @@ $(foreach pkg,$(BOOTSTRAP),$(eval $(call VENDOR_BIN_TMPL,$(pkg))))
 
 # Version flags to embed in the binaries
 VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
+# If we are not in an active git dir then try reading the version from .VERSION.
+# .VERSION contains a slug populated by `git archive`.
+VERSION := $(or $(VERSION),$(shell ./.version.sh .VERSION))
 VERSION := $(shell echo $(VERSION) | sed 's/^v//')
 
 # If TRAVIS_TAG is set then we know this ref has been tagged.
@@ -99,7 +102,7 @@ test:
 vtest:
 	$(Q)for d in $$(go list ./... | grep -v vendor); do \
     echo -e "TESTS FOR: for \033[0;35m$$d\033[0m"; \
-    $(GOFLAGS) go test -v -bench=. -run=. -short -coverprofile=coverage.out $$d; \
+    $(GOFLAGS) go test -v -bench=. -run=. -short -coverprofile=vcoverage.out $$d; \
 	out=$$?; \
 	if [[ $$out -ne 0 ]]; then ret=$$out; fi;\
     rm -f profile.coverage.out; \
@@ -153,6 +156,19 @@ uninstall:
 
 .PHONY: install uninstall
 
+#########################################
+# Clean
+#########################################
+
+clean:
+	@echo "You will need to run 'make bootstrap' or 'dep ensure' directly to re-download any dependencies."
+	$Q rm -rf vendor
+ifneq ($(BINNAME),"")
+	$Q rm -f bin/$(BINNAME)
+endif
+
+.PHONY: clean
+
 #########################################
 # Building Docker Image
 #
@@ -301,16 +317,3 @@ artifacts-release: artifacts-tag
 artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE)
 
 .PHONY: artifacts-master artifacts-release artifacts
-
-#########################################
-# Clean
-#########################################
-
-clean:
-	@echo "You will need to run 'make bootstrap' or 'dep ensure' directly to re-download any dependencies."
-	$Q rm -rf vendor
-ifneq ($(BINNAME),"")
-	$Q rm -f bin/$(BINNAME)
-endif
-
-.PHONY: clean

+ 2 - 2
debian/changelog

@@ -1,5 +1,5 @@
-step-certificates (0.0.1-rc.2) unstable; urgency=medium
+step-certificates (0.8.4-14-ge72f087-dev) unstable; urgency=medium
 
   * See https://github.com/smallstep/certificates/releases
 
- -- Smallstep Labs, Inc. <techadmin@smallstep.com>  Thu, 01 Nov 2018 00:00:00 +0000
+ -- Smallstep Labs, Inc. <techadmin@smallstep.com>  Wed, 20 Feb 2019 20:44:25 +0000