versioning

This commit is contained in:
Pavel 2023-11-19 13:13:38 +03:00
parent 666daabe95
commit 90332cd134
2 changed files with 11 additions and 5 deletions

View File

@ -5,12 +5,14 @@ ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR=$(ROOT_DIR)/build
BIN=$(BUILD_DIR)/sshpoke
GO_VERSION=$(shell go version | sed -e 's/go version //')
VERSION=$(shell git describe --tags 2>/dev/null || git log --format="v0.0.0-%h" -n 1 || echo "v0.0.0-unknown")
LDFLAGS="-X 'github.com/Neur0toxine/sshpoke/cmd.Version=${VERSION}'"
.PHONY: run clean_backend
build: generate deps fmt
@echo " ► Building with ${GO_VERSION}"
@CGO_ENABLED=0 go build -tags=release -o $(BIN) .
@CGO_ENABLED=0 go build -tags=release -ldflags ${LDFLAGS} -o $(BIN) .
@echo $(BIN)
test: deps fmt

View File

@ -17,10 +17,14 @@ import (
"github.com/spf13/viper"
)
var cfgFile string
var (
cfgFile string
Version string
)
var rootCmd = &cobra.Command{
Use: "sshpoke",
Version: Version,
Short: "Expose your Docker services to the Internet via SSH.",
Long: `sshpoke is a CLI application that listens to the docker socket and automatically exposes relevant services to the Internet.`,
Run: func(cmd *cobra.Command, args []string) {