Skip to content

Commit 766351c

Browse files
author
Tobias Meinhardt
committed
New git service function for pushing only tags
1 parent da2b6ef commit 766351c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

git/service.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Service interface {
1515
IsRepoClean() (bool, error)
1616
CreateTag(version string) error
1717
Push() error
18+
PushTag(name string) error
1819
AddVersionChanges(filename string) error
1920
CommitVersionChanges(version string) error
2021
}
@@ -62,6 +63,14 @@ func (s service) Push() error {
6263
return errors.Wrap(err, fmt.Sprintf("pkg(git) Push(): %s", stderr.String()))
6364
}
6465

66+
func (s service) PushTag(version string) error {
67+
cmd := exec.Command(s.gitPath, "push", "origin", "v"+version)
68+
var stderr bytes.Buffer
69+
cmd.Stderr = &stderr
70+
err := cmd.Run()
71+
return errors.Wrap(err, fmt.Sprintf("pkg(git) PushTag(): %s", stderr.String()))
72+
}
73+
6574
func (s service) AddVersionChanges(filename string) error {
6675
repoPath, err := s.GitRepoPath()
6776
if err != nil {

0 commit comments

Comments
 (0)