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 {