From 5513754c22e0de64f42a27ce6b2c843f12a7dc16 Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Wed, 22 Dec 2021 02:01:48 +0100 Subject: [PATCH] fix: push tags --- cli/recipe/release.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/recipe/release.go b/cli/recipe/release.go index ff8ed1b8..55c29567 100644 --- a/cli/recipe/release.go +++ b/cli/recipe/release.go @@ -17,6 +17,7 @@ import ( "github.com/AlecAivazis/survey/v2" "github.com/docker/distribution/reference" "github.com/go-git/go-git/v5" + configPkg "github.com/go-git/go-git/v5/config" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" ) @@ -318,7 +319,13 @@ func pushRelease(tagString string, repo *git.Repository) error { } if internal.Push { - if err := repo.Push(&git.PushOptions{}); err != nil { + tagRef := fmt.Sprintf("+refs/tags/%s:refs/tags/%s", tagString, tagString) + pushOpts := &git.PushOptions{ + RefSpecs: []configPkg.RefSpec{ + configPkg.RefSpec(tagRef), + }, + } + if err := repo.Push(pushOpts); err != nil { return err } logrus.Info(fmt.Sprintf("pushed tag %s to remote", tagString))