diff --git a/README.md b/README.md index 571aff855964b5f3a3356008e81c57b13bb36b5b..a0aafb2eda9ff436002dce6e3e4b7acb8a59de05 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ To use this plugin you need to include the following block in your | auth_username | git | The name of the user to use for authentication. | | auth_password | | The password to use for basic auth or the SSH key. | | auth_private_key | | The path to an SSH private key file. | -| git_path | . | The path to the Git repository | +| git_path | . | The path to the Git repository. | +| push_options | | The push options for the git tag push. | ### Authentication diff --git a/pkg/provider/git.go b/pkg/provider/git.go index 9e81d9b24634da0315dd7b6500d6427c8d1ce9d7..c8160435b41229c2ff460e125998f147f6f18129 100644 --- a/pkg/provider/git.go +++ b/pkg/provider/git.go @@ -28,6 +28,7 @@ type Repository struct { remoteName string auth transport.AuthMethod repo *git.Repository + pushOptions map[string]string } func (repo *Repository) Init(config map[string]string) error { @@ -68,6 +69,15 @@ func (repo *Repository) Init(config map[string]string) error { repo.auth = nil } + if config["push_options"] != "" { + options := strings.Split(config["push_options"], ",") + repo.pushOptions = make(map[string]string, len(options)) + for _, o := range options { + key, value, _ := strings.Cut(o, "=") + repo.pushOptions[key] = value + } + } + gitPath := config["git_path"] if gitPath == "" { gitPath = "." @@ -201,7 +211,8 @@ func (repo *Repository) CreateRelease(release *provider.CreateReleaseConfig) err RefSpecs: []config.RefSpec{ config.RefSpec(fmt.Sprintf("refs/tags/%s:refs/tags/%s", tag, tag)), }, - Auth: repo.auth, + Auth: repo.auth, + Options: repo.pushOptions, }) return err }