Skip to content

Commit

Permalink
Added version operability for git archive tarball (non git repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
dopey committed Feb 21, 2019
1 parent 77bb7eb commit c23eb88
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 19 deletions.
1 change: 1 addition & 0 deletions .VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$Format:%d$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.VERSION export-subst
7 changes: 7 additions & 0 deletions .version.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 18 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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; \
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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. <[email protected]> Thu, 01 Nov 2018 00:00:00 +0000
-- Smallstep Labs, Inc. <[email protected]> Wed, 20 Feb 2019 20:44:25 +0000

0 comments on commit c23eb88

Please sign in to comment.