From 44f0135574843da471ccdd05c058272533318e0e Mon Sep 17 00:00:00 2001 From: nathanmartinszup <63246935+nathanmartinszup@users.noreply.github.com> Date: Fri, 26 Nov 2021 14:30:44 -0300 Subject: [PATCH] mageutils:bugfix - use name instead of tag name and push release branch (#137) Signed-off-by: Nathan Martins --- pkg/utils/mageutils/release.go | 6 +++++- pkg/utils/mageutils/version.go | 2 +- pkg/utils/mageutils/version_test.go | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/utils/mageutils/release.go b/pkg/utils/mageutils/release.go index 4e9fe7e..33cf039 100644 --- a/pkg/utils/mageutils/release.go +++ b/pkg/utils/mageutils/release.go @@ -52,7 +52,11 @@ func CheckoutReleaseBranch(branchName string) error { if err := sh.RunV("git", "checkout", branchName); err != nil { log.Printf("First %s release, creating release branch", branchName) - return sh.RunV("git", "checkout", "-b", branchName) + if err := sh.RunV("git", "checkout", "-b", branchName); err != nil { + return err + } + + return sh.RunV("git", "push", "--set-upstream", "origin", branchName) } return nil diff --git a/pkg/utils/mageutils/version.go b/pkg/utils/mageutils/version.go index f7443d4..3c5b12c 100644 --- a/pkg/utils/mageutils/version.go +++ b/pkg/utils/mageutils/version.go @@ -156,7 +156,7 @@ func (u *upVersions) getLatestRelease() error { return err } - u.actualReleaseVersion = *release.TagName + u.actualReleaseVersion = release.GetName() return nil } diff --git a/pkg/utils/mageutils/version_test.go b/pkg/utils/mageutils/version_test.go index e74b8a5..66faca5 100644 --- a/pkg/utils/mageutils/version_test.go +++ b/pkg/utils/mageutils/version_test.go @@ -56,7 +56,7 @@ func toStringPointer(value string) *string { } func newMockRelease(tagName string) *github.RepositoryRelease { - return &github.RepositoryRelease{TagName: toStringPointer(tagName)} + return &github.RepositoryRelease{Name: toStringPointer(tagName)} } func newMockTags(tags []string) []*github.RepositoryTag {