Skip to content

Commit

Permalink
Embed version string from git description
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Jan 9, 2024
1 parent 9681490 commit 5e6b5dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
VERSION := $(shell git describe --always --dirty --tags)

CGO_ENABLED = 0
# Strip binaries by default to make them smaller.
GO_LDFLAGS = -s -w
GO_LDFLAGS = -s -w -X github.com/rstudio/rskey/cmd.Version=$(VERSION)
# Using the 'netgo' tag opts into the native implementation and allows for
# static binaries.
GO_BUILD_ARGS = -v -tags "netgo" -trimpath

GOPATH = `go env GOPATH`
GOPATH = $(shell go env GOPATH)
ADDLICENSE = $(GOPATH)/bin/addlicense
ADDLICENSE_ARGS = -v -s=only -l=apache -c "RStudio, PBC" -ignore 'coverage*' -ignore '.github/**' -ignore '.goreleaser.yaml'
NOTICETOOL = $(GOPATH)/bin/go-licence-detector
Expand Down
9 changes: 7 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ import (
"github.com/spf13/cobra"
)

var (
Version = "???"
)

var rootCmd = &cobra.Command{
Use: "rskey",
Short: "Manage keys and secrets for RStudio Connect and Package Manager",
Use: "rskey",
Short: "Manage keys and secrets for RStudio Connect and Package Manager",
Version: Version,
}

// Execute runs the rskey command. On error it will call os.Exit.
Expand Down

0 comments on commit 5e6b5dc

Please sign in to comment.