Skip to content

Commit

Permalink
feat: correct release tagging for multi sdk repo (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-timothy-albert authored Jun 26, 2024
1 parent 31a5a50 commit f24841e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/actions/publishEvent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
5 changes: 4 additions & 1 deletion internal/git/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f24841e

Please sign in to comment.