From 5c87d4775ca355245f99177da242f702098507c0 Mon Sep 17 00:00:00 2001 From: OliverNocon Date: Wed, 6 Nov 2019 09:05:07 +0100 Subject: [PATCH] Ensure asset update for latest release only --- cmd/githubPublishRelease.go | 3 ++- cmd/githubPublishRelease_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/githubPublishRelease.go b/cmd/githubPublishRelease.go index 1963bda85..aad18dd4d 100644 --- a/cmd/githubPublishRelease.go +++ b/cmd/githubPublishRelease.go @@ -58,7 +58,8 @@ func runGithubPublishRelease(ctx context.Context, myGithubPublishReleaseOptions publishedAt = lastRelease.GetPublishedAt() log.Entry().Debugf("Previous GitHub release published: '%v'", publishedAt) - if myGithubPublishReleaseOptions.UpdateAsset { + //updating assets only supported on latest release + if myGithubPublishReleaseOptions.UpdateAsset && myGithubPublishReleaseOptions.Version == "latest" { return uploadReleaseAsset(ctx, lastRelease.GetID(), myGithubPublishReleaseOptions, ghRepoClient) } diff --git a/cmd/githubPublishRelease_test.go b/cmd/githubPublishRelease_test.go index 9008d3e8c..95aafc493 100644 --- a/cmd/githubPublishRelease_test.go +++ b/cmd/githubPublishRelease_test.go @@ -171,6 +171,7 @@ func TestRunGithubPublishRelease(t *testing.T) { myGithubPublishReleaseOptions := githubPublishReleaseOptions{ UpdateAsset: true, AssetPath: filepath.Join("testdata", t.Name()+"_test.txt"), + Version: "latest", } err := runGithubPublishRelease(ctx, &myGithubPublishReleaseOptions, &ghRepoClient, &ghIssueClient)