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

This commit is contained in:
max furman 2019-02-20 12:45:10 -08:00
parent 77bb7eb86a
commit c23eb88a4f
6 changed files with 31 additions and 19 deletions

1
.VERSION Normal file
View file

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

1
.gitattributes vendored Normal file
View file

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

7
.version.sh Executable file
View file

@ -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}"

4
Gopkg.lock generated
View file

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

View file

@ -11,7 +11,7 @@ OUTPUT_ROOT=output/
# Set shell to bash for `echo -e` # Set shell to bash for `echo -e`
SHELL := /bin/bash SHELL := /bin/bash
all: build lint test all: build test lint
.PHONY: all .PHONY: all
@ -49,6 +49,9 @@ $(foreach pkg,$(BOOTSTRAP),$(eval $(call VENDOR_BIN_TMPL,$(pkg))))
# Version flags to embed in the binaries # Version flags to embed in the binaries
VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev") 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//') VERSION := $(shell echo $(VERSION) | sed 's/^v//')
# If TRAVIS_TAG is set then we know this ref has been tagged. # If TRAVIS_TAG is set then we know this ref has been tagged.
@ -99,7 +102,7 @@ test:
vtest: vtest:
$(Q)for d in $$(go list ./... | grep -v vendor); do \ $(Q)for d in $$(go list ./... | grep -v vendor); do \
echo -e "TESTS FOR: for \033[0;35m$$d\033[0m"; \ 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=$$?; \ out=$$?; \
if [[ $$out -ne 0 ]]; then ret=$$out; fi;\ if [[ $$out -ne 0 ]]; then ret=$$out; fi;\
rm -f profile.coverage.out; \ rm -f profile.coverage.out; \
@ -153,6 +156,19 @@ uninstall:
.PHONY: install 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 # Building Docker Image
# #
@ -301,16 +317,3 @@ artifacts-release: artifacts-tag
artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE) artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE)
.PHONY: artifacts-master artifacts-release artifacts .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

4
debian/changelog vendored
View file

@ -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 * 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