Support only master branch
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2cc57167b8
commit
e2e8f54ab4
@ -54,6 +54,10 @@ func (p Plugin) Exec() error {
|
|||||||
files []string
|
files []string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if p.Build.Event != "tag" && p.Repo.Branch != "master" {
|
||||||
|
return fmt.Errorf("The Gitea Release plugin is only available for tags or master branch")
|
||||||
|
}
|
||||||
|
|
||||||
if p.Config.APIKey == "" {
|
if p.Config.APIKey == "" {
|
||||||
return fmt.Errorf("You must provide an API key")
|
return fmt.Errorf("You must provide an API key")
|
||||||
}
|
}
|
||||||
@ -121,7 +125,7 @@ func (p Plugin) Exec() error {
|
|||||||
client.SetHTTPClient(insecureClient)
|
client.SetHTTPClient(insecureClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
tag := p.Repo.Branch
|
tag := "latest"
|
||||||
if p.Build.Event == "tag" {
|
if p.Build.Event == "tag" {
|
||||||
tag = strings.TrimPrefix(p.Commit.Ref, "refs/tags/")
|
tag = strings.TrimPrefix(p.Commit.Ref, "refs/tags/")
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ func (rc *releaseClient) getRelease() (*gitea.Release, error) {
|
|||||||
return nil, fmt.Errorf("Failed to delete a release: %s", err)
|
return nil, fmt.Errorf("Failed to delete a release: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Successfully deleted %s release", rc.Tag)
|
fmt.Printf("Successfully deleted %s release\n", rc.Tag)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user