From f24841e0ce7bb791668fd98c35fe917aed096b5e Mon Sep 17 00:00:00 2001 From: Ryan Albert <42415738+ryan-timothy-albert@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:22:37 -0700 Subject: [PATCH] feat: correct release tagging for multi sdk repo (#144) --- internal/actions/publishEvent.go | 2 +- internal/git/releases.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/actions/publishEvent.go b/internal/actions/publishEvent.go index 34d393b1..ac10f862 100644 --- a/internal/actions/publishEvent.go +++ b/internal/actions/publishEvent.go @@ -17,7 +17,7 @@ func PublishEventAction() error { version, err := telemetry.TriggerPublishingEvent(os.Getenv("INPUT_TARGET_DIRECTORY"), os.Getenv("GH_ACTION_RESULT"), os.Getenv("INPUT_REGISTRY_NAME")) if version != "" { if strings.Contains(os.Getenv("GH_ACTION_RESULT"), "success") { - if err = g.SetReleaseToPublished(version); err != nil { + if err = g.SetReleaseToPublished(version, os.Getenv("INPUT_TARGET_DIRECTORY")); err != nil { fmt.Println("Failed to set release to published %w", err) } } diff --git a/internal/git/releases.go b/internal/git/releases.go index 8e7b301f..59002679 100644 --- a/internal/git/releases.go +++ b/internal/git/releases.go @@ -18,11 +18,14 @@ import ( //go:embed goreleaser.yml var tfGoReleaserConfig string -func (g *Git) SetReleaseToPublished(version string) error { +func (g *Git) SetReleaseToPublished(version, directory string) error { if g.repo == nil { return fmt.Errorf("repo not cloned") } tag := "v" + version + if directory != "" && directory != "." && directory != "./" { + tag = fmt.Sprintf("%s/%s", directory, tag) + } release, _, err := g.client.Repositories.GetReleaseByTag(context.Background(), os.Getenv("GITHUB_REPOSITORY_OWNER"), getRepo(), tag) if err != nil {