forked from toolshed/abra
fix: clone https url by default
Catalogue package had to be merged into the recipe package due to too many circular import errors. Also, use https url for cloning, assume folks don't have ssh setup by default (the whole reason for the refactor).
This commit is contained in:
@ -17,7 +17,6 @@ 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"
|
||||
)
|
||||
@ -214,7 +213,7 @@ func createReleaseFromTag(recipe recipe.Recipe, tagString, mainAppVersion string
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := pushRelease(tagString, repo); err != nil {
|
||||
if err := pushRelease(recipe.Dir()); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
@ -309,7 +308,7 @@ func tagRelease(tagString string, repo *git.Repository) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func pushRelease(tagString string, repo *git.Repository) error {
|
||||
func pushRelease(recipeDir string) error {
|
||||
if internal.Dry {
|
||||
logrus.Info("dry run: no changes pushed")
|
||||
return nil
|
||||
@ -326,21 +325,9 @@ func pushRelease(tagString string, repo *git.Repository) error {
|
||||
}
|
||||
|
||||
if internal.Push {
|
||||
if err := repo.Push(&git.PushOptions{}); err != nil {
|
||||
if err := gitPkg.Push(recipeDir, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -416,7 +403,7 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := pushRelease(newTagString, repo); err != nil {
|
||||
if err := pushRelease(recipe.Dir()); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user