Update versioning and logging in SteamCache2
All checks were successful
PR Check / check-and-test (pull_request) Successful in 11s

- Enhanced .goreleaser.yaml for improved build configuration, including static linking and ARM64 support.
- Updated logging in root.go to include version date during startup.
- Modified version.go to initialize and expose the build date alongside the version.
- Adjusted version command output to display both version and date for better clarity.
This commit is contained in:
2025-07-19 02:58:19 -05:00
parent 4876998f5d
commit ae07239021
4 changed files with 32 additions and 18 deletions

View File

@@ -2,11 +2,17 @@ version: 2
before: before:
hooks: hooks:
- go mod tidy - go mod tidy -v
builds: builds:
- ldflags: - id: default
binary: steamcache2
ldflags:
- -s
- -w
- -extldflags "-static"
- -X s1d3sw1ped/SteamCache2/version.Version={{.Version}} - -X s1d3sw1ped/SteamCache2/version.Version={{.Version}}
- -X s1d3sw1ped/SteamCache2/version.Date={{.Date}}
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
goos: goos:
@@ -14,19 +20,25 @@ builds:
- windows - windows
goarch: goarch:
- amd64 - amd64
- arm64
ignore:
- goos: windows
goarch: arm64
checksum:
name_template: "checksums.txt"
archives: archives:
- formats: tar.gz - id: default
name_template: >- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
{{ .ProjectName }}_ formats: tar.gz
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides: format_overrides:
- goos: windows - goos: windows
formats: zip formats: zip
files:
- README.md
- LICENSE
- steamcache2
changelog: changelog:
sort: asc sort: asc
@@ -36,12 +48,8 @@ changelog:
- "^test:" - "^test:"
release: release:
name_template: '{{.ProjectName}}-{{.Version}}' name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
footer: >- footer: "Copyright (c) 2025 s1d3sw1ped"
---
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
gitea_urls: gitea_urls:
api: https://git.s1d3sw1ped.com/api/v1 api: https://git.s1d3sw1ped.com/api/v1

View File

@@ -56,7 +56,7 @@ var rootCmd = &cobra.Command{
logger.Logger = zerolog.New(writer).With().Timestamp().Logger() logger.Logger = zerolog.New(writer).With().Timestamp().Logger()
logger.Logger.Info(). logger.Logger.Info().
Msg("SteamCache2 " + version.Version + " starting...") Msg("SteamCache2 " + version.Version + " " + version.Date + " starting...")
address := ":80" address := ":80"

View File

@@ -15,7 +15,7 @@ var versionCmd = &cobra.Command{
Short: "prints the version of SteamCache2", Short: "prints the version of SteamCache2",
Long: `Prints the version of SteamCache2. This command is useful for checking the version of the application.`, Long: `Prints the version of SteamCache2. This command is useful for checking the version of the application.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintln(os.Stderr, "SteamCache2", version.Version) fmt.Fprintln(os.Stderr, "SteamCache2", version.Version, version.Date)
}, },
} }

View File

@@ -1,10 +1,16 @@
// version/version.go // version/version.go
package version package version
import "time"
var Version string var Version string
var Date string
func init() { func init() {
if Version == "" { if Version == "" {
Version = "0.0.0-dev" Version = "0.0.0-dev"
} }
if Date == "" {
Date = time.Now().Format("2006-01-02 15:04:05")
}
} }