diff --git a/.gitea/workflows/workflow.yaml b/.gitea/workflows/workflow.yaml index f309592..665dfa4 100644 --- a/.gitea/workflows/workflow.yaml +++ b/.gitea/workflows/workflow.yaml @@ -19,7 +19,12 @@ jobs: go-version: '1.24.6' # You can specify a specific version or 'stable' - name: Build - run: go build -v ./... + run: | + go build -v -ldflags "\ + -X main.version=${{ github.ref_name }} \ + -X main.commit=${{ github.sha }} \ + -X main.date=$(date +%Y-%m-%dT%H:%M:%S%z)" \ + -o clean_file - name: Test run: go test -v ./... diff --git a/README.md b/README.md index d133863..94a454e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ CLI software that processes a text file containing US phone numbers and sanitizes the numbers. The result is contained in a json file. + +## Building +``` +go build +``` + + +To include version information +``` +go build -ldflags "-X main.version=3.0.101 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date +%Y-%m-%dT%H:%M:%S%z)" -o clean_file +``` diff --git a/main.go b/main.go index 659852b..821bac8 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,6 @@ import "fmt" import "os" import "git.kundeng.us/phoenix/clean_file/parser" -const VERSION = "0.3.101" - func main() { fmt.Println("clean_file") args := os.Args diff --git a/version/version.go b/version/version.go new file mode 100644 index 0000000..874433c --- /dev/null +++ b/version/version.go @@ -0,0 +1,7 @@ +package version + +var ( + Version = "dev" + Commit = "none" + Date = "unknown" +)