Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pkg/utils/mageutils/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,32 @@ func CreateLocalTag(tag string) (err error) {
return sh.RunV("git", "tag", "-s", tag, "-m", "release "+tag)
}

// CreateAndPushTag create and push a new given tag executing
// "git tag -s tag -m release+tag" and "git push --tags"
func CreateAndPushTag(tag string) (err error) {
mg.Deps(isGitExistent)
mg.Deps(mg.F(isValidTag, tag))

if err := sh.RunV("git", "tag", "-s", tag, "-m", "release "+tag); err != nil {
return err
}

return sh.RunV("git", "push", "--tags")
}

// RemoveTag remove tag locally and in the origin
// "git tag -d tag" and "git push --delete origin tag"
func RemoveTag(tag string) (err error) {
mg.Deps(isGitExistent)
mg.Deps(mg.F(isValidTag, tag))

if err := sh.RunV("git", "tag", "-d", tag); err != nil {
return err
}

return sh.RunV("git", "push", "--delete", "origin", tag)
}

// CheckoutReleaseBranch creates if not exists a release branch and then checkout
// @TODO validate release branch name with regex
func CheckoutReleaseBranch(branchName string) error {
Expand Down