add versioning (#11)

Reviewed-on: #11
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-09-01 22:13:29 +00:00
committed by phoenix
parent 71c99cdb50
commit 4a109467e3
4 changed files with 24 additions and 3 deletions
+6 -1
View File
@@ -19,7 +19,12 @@ jobs:
go-version: '1.24.6' # You can specify a specific version or 'stable' go-version: '1.24.6' # You can specify a specific version or 'stable'
- name: Build - 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 - name: Test
run: go test -v ./... run: go test -v ./...
+11
View File
@@ -1,2 +1,13 @@
CLI software that processes a text file containing US phone numbers CLI software that processes a text file containing US phone numbers
and sanitizes the numbers. The result is contained in a json file. 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
```
-2
View File
@@ -4,8 +4,6 @@ import "fmt"
import "os" import "os"
import "git.kundeng.us/phoenix/clean_file/parser" import "git.kundeng.us/phoenix/clean_file/parser"
const VERSION = "0.3.101"
func main() { func main() {
fmt.Println("clean_file") fmt.Println("clean_file")
args := os.Args args := os.Args
+7
View File
@@ -0,0 +1,7 @@
package version
var (
Version = "dev"
Commit = "none"
Date = "unknown"
)