ci: add version variable linkage to build command

This commit is contained in:
Slug-Boi
2024-11-29 23:53:42 +01:00
parent 08d1942492
commit 8f9e1e9ccb
+5 -2
View File
@@ -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)
@@ -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))
@@ -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))