Skip to content

Commit

Permalink
ci: add version variable linkage to build command
Browse files Browse the repository at this point in the history
  • Loading branch information
Slug-Boi committed Nov 29, 2024
1 parent 08d1942 commit 8f9e1e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ci/build_test_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func main() {

buildDir := test.Directory("/src_d/src/")

Coco_var := os.Getenv("Coco_Version")


for _, goos := range geese {
path := fmt.Sprintf("/dist/")
filename := fmt.Sprintf("/dist/cocommit-%s", goos)
Expand All @@ -50,7 +53,7 @@ func main() {
build := test.
WithEnvVariable("GOOS", goos).
WithEnvVariable("GOARCH", goarch).
WithExec([]string{"go", "build", "-o", filename}).WithEnvVariable("CI", "true")
WithExec([]string{"go", "build", "-o", filename, "-ldflags", "-X github.com/Slug-Boi/cocommit/src/cmd.Coco_Version="+Coco_var}).WithEnvVariable("CI", "true")

buildDir = buildDir.WithDirectory(path, build.Directory(path))

Expand All @@ -63,7 +66,7 @@ func main() {
build := test.
WithEnvVariable("GOOS", "darwin").
WithEnvVariable("GOARCH", "arm64").
WithExec([]string{"go", "build", "-o", filename}).WithEnvVariable("CI", "true")
WithExec([]string{"go", "build", "-o", filename, "-ldflags", "-X github.com/Slug-Boi/cocommit/src/cmd.Coco_Version="+Coco_var}).WithEnvVariable("CI", "true")

buildDir = buildDir.WithDirectory(path, build.Directory(path))

Expand Down

0 comments on commit 8f9e1e9

Please sign in to comment.