Skip to content
Snippets Groups Projects
Unverified Commit cb5045bc authored by Andreas Jaekle's avatar Andreas Jaekle Committed by GitHub
Browse files

feat: allow to set custom push options (#7)

parent c383a9f3
Branches
Tags
No related merge requests found
......@@ -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
......
......@@ -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 = "."
......@@ -202,6 +212,7 @@ func (repo *Repository) CreateRelease(release *provider.CreateReleaseConfig) err
config.RefSpec(fmt.Sprintf("refs/tags/%s:refs/tags/%s", tag, tag)),
},
Auth: repo.auth,
Options: repo.pushOptions,
})
return err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment