Skip to content

Commit

Permalink
feat: basic version support
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesw committed Apr 4, 2024
1 parent 6b9817b commit 4ae2fed
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
builds:
- env:
ldflags:
- -s -w -X main.version={{.Version}}
goos:
- darwin
- windows
Expand Down
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Get the latest tag
latestTag=$(git describe --tags)

echo "latest tag: $latestTag"

# Build the Go program, injecting the latest tag into the version variable
go build -ldflags "-X main.version=$latestTag" -o jinjafier

8 changes: 8 additions & 0 deletions jinjafier.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import (
"gopkg.in/yaml.v3"
)

var version = "dev"

func main() {

if os.Args[1] == "-v" {
fmt.Println("Jinjafier version:", version)
os.Exit(0)
}

if len(os.Args) != 2 {
fmt.Println("Usage: jinjafier <java_properties_file>")
os.Exit(1)
Expand Down

0 comments on commit 4ae2fed

Please sign in to comment.