Skip to content

Commit

Permalink
chore: add release version
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Aug 12, 2024
1 parent 8898a13 commit 8a03e6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ builds:
- arm64
ldflags:
- -s -w
- -X github.com/zeiss/service-lens/cmd.version={{ .Tag }}
- -X github.com/zeiss/service-lens/cmd.commit={{ .FullCommit }}
- -X github.com/zeiss/service-lens/cmd.date={{ .Date }}
- -X github.com/zeiss/service-lens/cmd.os={{ .Os }}
- -X github.com/zeiss/service-lens/cmd.arch={{ .Arch }}

archives:
- id: main
Expand Down
12 changes: 12 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"fmt"
"log"

"github.com/kelseyhightower/envconfig"
Expand All @@ -24,6 +25,16 @@ import (
"gorm.io/gorm/schema"
)

var (
version = "dev"
commit = "none"
date = "unknown"
os = "unknown"
arch = "unknown"
)

var versionFmt = fmt.Sprintf("%s-%s (%s) %s/%s", version, commit, date, os, arch)

var config *cfg.Config

func init() {
Expand All @@ -49,6 +60,7 @@ func init() {
}

var Root = &cobra.Command{
Version: versionFmt,
RunE: func(cmd *cobra.Command, args []string) error {
srv := NewWebSrv(config)

Expand Down

0 comments on commit 8a03e6f

Please sign in to comment.