From acff4152ce85c9245df3d1bad05feb66f6db5e98 Mon Sep 17 00:00:00 2001 From: Thomas Labarussias Date: Thu, 12 Oct 2023 21:49:50 +0200 Subject: [PATCH] update GHA for main branch Signed-off-by: Thomas Labarussias --- mageFile.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/mageFile.go b/mageFile.go index b8f3c312..f9428d58 100644 --- a/mageFile.go +++ b/mageFile.go @@ -44,7 +44,7 @@ func BuildLocal() error { } // BuildImages build images locally and not push -func BuildImages() error { +func BuildLocaleImages() error { exportLDFlags() os.Setenv("KO_DOCKER_REPO", "ko.local/falco-talon") @@ -52,11 +52,25 @@ func BuildImages() error { "github.com/Issif/falco-talon") } -func Build() error { - mg.Deps(Test) +func BuildImages() error { + exportLDFlags() + os.Setenv("KO_DOCKER_REPO", "issif/falco-talon") + + return sh.RunV("ko", "build", "--bare", "--sbom=none", "--tags", getVersion(), "--tags", getCommit(), "--tags", "latest", + "github.com/Issif/falco-talon") +} + +func PushImages() error { + mg.Deps(BuildImages) + os.Setenv("KO_DOCKER_REPO", "issif/falco-talon") + + return sh.RunV("ko", "build", "--bare", "--sbom=none", "--tags", getVersion(), "--tags", getCommit(), "--tags", "latest", + "github.com/Issif/falco-talon") +} +func Build() error { exportLDFlags() - return sh.RunV("goreleaser", "release", "--clean", "--skip-sign", "--skip-sbom", "--skip-publish") + return sh.RunV("goreleaser", "release", "--clean", "--snapshot", "--skip-sbom", "--skip-publish") } func Release() error { @@ -86,8 +100,10 @@ func getVersion() string { return version } + gitBranch, _ := sh.Output("git", "branch", "--show-current") + // repo without any tags in it - return "v0.0.0" + return gitBranch } // getCommit gets the hash of the current commit