diff --git a/plugin.go b/plugin.go index 480f1a7..b5d614c 100644 --- a/plugin.go +++ b/plugin.go @@ -54,6 +54,10 @@ func (p Plugin) Exec() error { 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 == "" { return fmt.Errorf("You must provide an API key") } @@ -121,7 +125,7 @@ func (p Plugin) Exec() error { client.SetHTTPClient(insecureClient) } - tag := p.Repo.Branch + tag := "latest" if p.Build.Event == "tag" { tag = strings.TrimPrefix(p.Commit.Ref, "refs/tags/") } diff --git a/release.go b/release.go index 3534082..e72cf60 100644 --- a/release.go +++ b/release.go @@ -65,7 +65,7 @@ func (rc *releaseClient) getRelease() (*gitea.Release, error) { 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 }