github.com/azunymous/cdx@v0.0.0-20201122180449-fbb46cc4d252/vcs/gogit/push.go (about)

     1  package gogit
     2  
     3  import (
     4  	"context"
     5  	"github.com/sirupsen/logrus"
     6  	"os/exec"
     7  	"time"
     8  )
     9  
    10  func (r *Repo) PushTags() error {
    11  	ctx, cancelFunc := context.WithTimeout(context.Background(), 30*time.Second)
    12  	defer cancelFunc()
    13  
    14  	logrus.Info("Pushing using git command")
    15  	cmd := exec.CommandContext(ctx, "git", "push", "--tags", "-q")
    16  
    17  	out, err := cmd.CombinedOutput()
    18  	logrus.Info(string(out))
    19  	if err != nil {
    20  		return err
    21  	}
    22  	return nil
    23  }