From e2e8f54ab41cd0ed714118f893df107e8dde5e72 Mon Sep 17 00:00:00 2001 From: Anton Zadvorny Date: Fri, 8 May 2020 03:40:15 +0300 Subject: [PATCH] Support only master branch --- plugin.go | 6 +++++- release.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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 }