1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

Ensure asset update for latest release only

This commit is contained in:
OliverNocon 2019-11-06 09:05:07 +01:00
parent 319066acf2
commit 5c87d4775c
2 changed files with 3 additions and 1 deletions

View File

@ -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)
}

View File

@ -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)