From 17c86c4c79e612ffb71384fbe0d40747c54a9202 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Thu, 26 Mar 2026 12:19:00 -0700 Subject: [PATCH] Push versioned tags to registry, not just :latest Build already creates both :latest and : tags, but push only pushed :latest. Now push detects the version via git describe and pushes both tags, giving the registry version history. Co-Authored-By: Claude Opus 4.6 (1M context) --- push.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/push.go b/push.go index f840fa7..611d0cb 100644 --- a/push.go +++ b/push.go @@ -24,6 +24,14 @@ func pushCommand() *cobra.Command { return err } + svcPath := cfg.ServicePath(svc) + + version, err := runOutput(svcPath, "git", "describe", "--tags", "--always", "--dirty") + if err != nil { + return fmt.Errorf("git describe in %s: %w", svcPath, err) + } + fmt.Printf("Version: %s\n", version) + images := svc.Images if imageFlag != "" { images = []string{imageFlag} @@ -31,11 +39,19 @@ func pushCommand() *cobra.Command { var pushed []string for _, image := range images { - ref := cfg.ImageRef(image) + ":latest" - if err := run("podman", "push", ref); err != nil { - return fmt.Errorf("push %s: %w", image, err) + ref := cfg.ImageRef(image) + tagLatest := ref + ":latest" + tagVersion := ref + ":" + version + + if err := run("podman", "push", tagLatest); err != nil { + return fmt.Errorf("push %s:latest: %w", image, err) } - pushed = append(pushed, ref) + pushed = append(pushed, tagLatest) + + if err := run("podman", "push", tagVersion); err != nil { + return fmt.Errorf("push %s:%s: %w", image, version, err) + } + pushed = append(pushed, tagVersion) } fmt.Printf("\nPushed %d image(s):\n", len(pushed))