Skip to content

Commit cb5045b

Browse files
authored
feat: allow to set custom push options (#7)
1 parent c383a9f commit cb5045b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ To use this plugin you need to include the following block in your
4141
| auth_username | git | The name of the user to use for authentication. |
4242
| auth_password | | The password to use for basic auth or the SSH key. |
4343
| auth_private_key | | The path to an SSH private key file. |
44-
| git_path | . | The path to the Git repository |
44+
| git_path | . | The path to the Git repository. |
45+
| push_options | | The push options for the git tag push. |
4546

4647
### Authentication
4748

pkg/provider/git.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Repository struct {
2828
remoteName string
2929
auth transport.AuthMethod
3030
repo *git.Repository
31+
pushOptions map[string]string
3132
}
3233

3334
func (repo *Repository) Init(config map[string]string) error {
@@ -68,6 +69,15 @@ func (repo *Repository) Init(config map[string]string) error {
6869
repo.auth = nil
6970
}
7071

72+
if config["push_options"] != "" {
73+
options := strings.Split(config["push_options"], ",")
74+
repo.pushOptions = make(map[string]string, len(options))
75+
for _, o := range options {
76+
key, value, _ := strings.Cut(o, "=")
77+
repo.pushOptions[key] = value
78+
}
79+
}
80+
7181
gitPath := config["git_path"]
7282
if gitPath == "" {
7383
gitPath = "."
@@ -201,7 +211,8 @@ func (repo *Repository) CreateRelease(release *provider.CreateReleaseConfig) err
201211
RefSpecs: []config.RefSpec{
202212
config.RefSpec(fmt.Sprintf("refs/tags/%s:refs/tags/%s", tag, tag)),
203213
},
204-
Auth: repo.auth,
214+
Auth: repo.auth,
215+
Options: repo.pushOptions,
205216
})
206217
return err
207218
}

0 commit comments

Comments
 (0)