From 0d7cc87b37a57672e3fcb82fcdb30f9ad2e1ef03 Mon Sep 17 00:00:00 2001 From: RaviAnand Mohabir Date: Wed, 3 Jul 2024 10:54:51 +0200 Subject: [PATCH] feat: :sparkles: output release url on success --- .gitignore | 25 +++++++++++++++++++++++++ plugin/plugin.go | 5 ++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f72f89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work +go.work.sum + +# env file +.env diff --git a/plugin/plugin.go b/plugin/plugin.go index 303562a..97571a4 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -137,7 +137,7 @@ func Exec(ctx context.Context, args Args) error { return fmt.Errorf("error creating Gitea client %w", err) } - _, _, err = client.CreateRelease(args.Owner, args.Repo, gitea.CreateReleaseOption{ + release, _, err := client.CreateRelease(args.Owner, args.Repo, gitea.CreateReleaseOption{ TagName: tag, Title: title, Note: note, @@ -148,5 +148,8 @@ func Exec(ctx context.Context, args Args) error { return fmt.Errorf("error creating Gitea release %w", err) } + releaseURL := fmt.Sprintf("%s/%s/%s/releases/tag/%s", args.GiteaUrl, args.Owner, args.Repo, release.TagName) + fmt.Printf("Successfully created release at %s", releaseURL) + return err }