Skip to content

Commit

Permalink
chore: update goreleaser config and version command
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed Aug 26, 2024
1 parent 62a6c65 commit 7839e03
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
26 changes: 23 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
version: 2
builds:
- dir: cmd/lagoon-linter
- id: lagoon-linter
binary: lagoon-linter
main: ./cmd/lagoon-linter
ldflags:
- >
-s -w -X main.date={{.Date}} -X "main.goVersion={{.Env.GOVERSION}}"
-X main.shortCommit={{.ShortCommit}} -X main.version={{.Version}}
-s -w
-X "main.commit={{.Commit}}"
-X "main.date={{.Date}}"
-X "main.projectName={{.ProjectName}}"
-X "main.version=v{{.Version}}"
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64

changelog:
use: github-native

release:
extra_files:
- glob: "{{ .Env.GITHUB_SBOM_PATH }}"
name_template: "{{ .ProjectName }}.v{{ .Version }}.sbom.spdx.json"
7 changes: 5 additions & 2 deletions cmd/lagoon-linter/version.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package main

import "fmt"
import (
"fmt"
"runtime"
)

// VersionCmd represents the version command.
type VersionCmd struct{}

// Run the version command to print version information.
func (cmd *VersionCmd) Run() error {
fmt.Printf("lagoon-linter %v (%v) compiled with %v on %v\n", version,
shortCommit, goVersion, date)
shortCommit, runtime.Version(), date)
return nil
}

0 comments on commit 7839e03

Please sign in to comment.