mirror of
https://github.com/smallstep/cli.git
synced 2025-04-19 10:42:15 +03:00
Added version operability for git archive
| updated zsh-completion
This commit is contained in:
parent
38ad9cdc7d
commit
68ac9850f4
7
.version.sh
Executable file
7
.version.sh
Executable 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}"
|
91
Makefile
91
Makefile
@ -2,5 +2,96 @@ all: build lint test
|
||||
|
||||
.PHONY: all
|
||||
|
||||
# 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))
|
||||
|
||||
-include make/common.mk
|
||||
-include make/docker.mk
|
||||
|
||||
#########################################
|
||||
# Debian
|
||||
#########################################
|
||||
|
||||
changelog:
|
||||
$Q echo "step-cli ($(VERSION)) unstable; urgency=medium" > debian/changelog
|
||||
$Q echo >> debian/changelog
|
||||
$Q echo " * See https://github.com/smallstep/cli/releases" >> debian/changelog
|
||||
$Q echo >> debian/changelog
|
||||
$Q echo " -- Smallstep Labs, Inc. <techadmin@smallstep.com> $(shell date -uR)" >> debian/changelog
|
||||
|
||||
debian: changelog
|
||||
$Q set -e; mkdir -p $(RELEASE); \
|
||||
OUTPUT=../step-cli_*.deb; \
|
||||
rm -f $$OUTPUT; \
|
||||
dpkg-buildpackage -b -rfakeroot -us -uc && cp $$OUTPUT $(RELEASE)/
|
||||
|
||||
distclean: clean
|
||||
|
||||
.PHONY: changelog debian distclean
|
||||
|
||||
#################################################
|
||||
# Build statically compiled step binary for various operating systems
|
||||
#################################################
|
||||
|
||||
BINARY_OUTPUT=$(OUTPUT_ROOT)binary/
|
||||
BUNDLE_MAKE=v=$v GOOS_OVERRIDE='GOOS=$(1) GOARCH=$(2)' PREFIX=$(3) make $(3)bin/step
|
||||
RELEASE=./.travis-releases
|
||||
|
||||
binary-linux:
|
||||
$(call BUNDLE_MAKE,linux,amd64,$(BINARY_OUTPUT)linux/)
|
||||
|
||||
binary-darwin:
|
||||
$(call BUNDLE_MAKE,darwin,amd64,$(BINARY_OUTPUT)darwin/)
|
||||
|
||||
define BUNDLE
|
||||
$(q)set -e; BUNDLE_DIR=$(BINARY_OUTPUT)$(1)/bundle; \
|
||||
stepName=step_$(2); \
|
||||
mkdir -p $$BUNDLE_DIR $(RELEASE); \
|
||||
TMP=$$(mktemp -d $$BUNDLE_DIR/tmp.XXXX); \
|
||||
trap "rm -rf $$TMP" EXIT INT QUIT TERM; \
|
||||
newdir=$$TMP/$$stepName; \
|
||||
mkdir -p $$newdir/bin; \
|
||||
cp $(BINARY_OUTPUT)$(1)/bin/step $$newdir/bin/; \
|
||||
cp README.md $$newdir/; \
|
||||
NEW_BUNDLE=$(RELEASE)/step_$(2)_$(1)_$(3).tar.gz; \
|
||||
rm -f $$NEW_BUNDLE; \
|
||||
tar -zcvf $$NEW_BUNDLE -C $$TMP $$stepName;
|
||||
endef
|
||||
|
||||
bundle-linux: binary-linux
|
||||
$(call BUNDLE,linux,$(VERSION),amd64)
|
||||
|
||||
bundle-darwin: binary-darwin
|
||||
$(call BUNDLE,darwin,$(VERSION),amd64)
|
||||
|
||||
.PHONY: binary-linux binary-darwin bundle-linux bundle-darwin
|
||||
|
||||
#################################################
|
||||
# Targets for creating OS specific artifacts
|
||||
#################################################
|
||||
|
||||
artifacts-linux-tag: bundle-linux debian
|
||||
|
||||
artifacts-darwin-tag: bundle-darwin
|
||||
|
||||
artifacts-tag: artifacts-linux-tag artifacts-darwin-tag
|
||||
|
||||
.PHONY: artifacts-linux-tag artifacts-darwin-tag artifacts-tag
|
||||
|
||||
#################################################
|
||||
# Targets for creating step artifacts
|
||||
#################################################
|
||||
|
||||
# For all builds that are not tagged
|
||||
artifacts-master:
|
||||
|
||||
# For all builds with a release tag
|
||||
artifacts-release: artifacts-tag
|
||||
|
||||
# This command is called by travis directly *after* a successful build
|
||||
artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE)
|
||||
|
||||
.PHONY: artifacts-master artifacts-release artifacts
|
||||
|
@ -1,5 +1,6 @@
|
||||
_cli_zsh_autocomplete() {
|
||||
#compdef _step step
|
||||
|
||||
function _step {
|
||||
local -a opts
|
||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
|
||||
|
||||
@ -7,5 +8,3 @@ _cli_zsh_autocomplete() {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
compdef _cli_zsh_autocomplete $PROG
|
||||
|
@ -151,91 +151,6 @@ uninstall:
|
||||
|
||||
.PHONY: install uninstall
|
||||
|
||||
#########################################
|
||||
# Debian
|
||||
#########################################
|
||||
|
||||
changelog:
|
||||
$Q echo "step-cli ($(VERSION)) unstable; urgency=medium" > debian/changelog
|
||||
$Q echo >> debian/changelog
|
||||
$Q echo " * See https://github.com/smallstep/cli/releases" >> debian/changelog
|
||||
$Q echo >> debian/changelog
|
||||
$Q echo " -- Smallstep Labs, Inc. <techadmin@smallstep.com> $(shell date -uR)" >> debian/changelog
|
||||
|
||||
debian: changelog
|
||||
$Q set -e; mkdir -p $(RELEASE); \
|
||||
OUTPUT=../step-cli_*.deb; \
|
||||
rm -f $$OUTPUT; \
|
||||
dpkg-buildpackage -b -rfakeroot -us -uc && cp $$OUTPUT $(RELEASE)/
|
||||
|
||||
distclean: clean
|
||||
|
||||
.PHONY: changelog debian distclean
|
||||
|
||||
#################################################
|
||||
# Build statically compiled step binary for various operating systems
|
||||
#################################################
|
||||
|
||||
BINARY_OUTPUT=$(OUTPUT_ROOT)binary/
|
||||
BUNDLE_MAKE=v=$v GOOS_OVERRIDE='GOOS=$(1) GOARCH=$(2)' PREFIX=$(3) make $(3)bin/step
|
||||
RELEASE=./.travis-releases
|
||||
|
||||
binary-linux:
|
||||
$(call BUNDLE_MAKE,linux,amd64,$(BINARY_OUTPUT)linux/)
|
||||
|
||||
binary-darwin:
|
||||
$(call BUNDLE_MAKE,darwin,amd64,$(BINARY_OUTPUT)darwin/)
|
||||
|
||||
define BUNDLE
|
||||
$(q)set -e; BUNDLE_DIR=$(BINARY_OUTPUT)$(1)/bundle; \
|
||||
stepName=step_$(2); \
|
||||
mkdir -p $$BUNDLE_DIR $(RELEASE); \
|
||||
TMP=$$(mktemp -d $$BUNDLE_DIR/tmp.XXXX); \
|
||||
trap "rm -rf $$TMP" EXIT INT QUIT TERM; \
|
||||
newdir=$$TMP/$$stepName; \
|
||||
mkdir -p $$newdir/bin; \
|
||||
cp $(BINARY_OUTPUT)$(1)/bin/step $$newdir/bin/; \
|
||||
cp README.md $$newdir/; \
|
||||
NEW_BUNDLE=$(RELEASE)/step_$(2)_$(1)_$(3).tar.gz; \
|
||||
rm -f $$NEW_BUNDLE; \
|
||||
tar -zcvf $$NEW_BUNDLE -C $$TMP $$stepName;
|
||||
endef
|
||||
|
||||
bundle-linux: binary-linux
|
||||
$(call BUNDLE,linux,$(VERSION),amd64)
|
||||
|
||||
bundle-darwin: binary-darwin
|
||||
$(call BUNDLE,darwin,$(VERSION),amd64)
|
||||
|
||||
.PHONY: binary-linux binary-darwin bundle-linux bundle-darwin
|
||||
|
||||
#################################################
|
||||
# Targets for creating OS specific artifacts
|
||||
#################################################
|
||||
|
||||
artifacts-linux-tag: bundle-linux debian
|
||||
|
||||
artifacts-darwin-tag: bundle-darwin
|
||||
|
||||
artifacts-tag: artifacts-linux-tag artifacts-darwin-tag
|
||||
|
||||
.PHONY: artifacts-linux-tag artifacts-darwin-tag artifacts-tag
|
||||
|
||||
#################################################
|
||||
# Targets for creating step artifacts
|
||||
#################################################
|
||||
|
||||
# For all builds that are not tagged
|
||||
artifacts-master:
|
||||
|
||||
# For all builds with a release tag
|
||||
artifacts-release: artifacts-tag
|
||||
|
||||
# This command is called by travis directly *after* a successful build
|
||||
artifacts: artifacts-$(PUSHTYPE) docker-$(PUSHTYPE)
|
||||
|
||||
.PHONY: artifacts-master artifacts-release artifacts
|
||||
|
||||
#########################################
|
||||
# Clean
|
||||
#########################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user