diff --git a/pipeline/scoop/scoop.go b/pipeline/scoop/scoop.go index 716bf3901..bcb68ca25 100644 --- a/pipeline/scoop/scoop.go +++ b/pipeline/scoop/scoop.go @@ -134,7 +134,7 @@ func getDownloadURL(ctx *context.Context, githubURL, file string) string { githubURL, ctx.Config.Release.GitHub.Owner, ctx.Config.Release.GitHub.Name, - ctx.Version, + ctx.Git.CurrentTag, file, ) } diff --git a/pipeline/scoop/scoop_test.go b/pipeline/scoop/scoop_test.go index 09eb778e1..448d23d06 100644 --- a/pipeline/scoop/scoop_test.go +++ b/pipeline/scoop/scoop_test.go @@ -431,13 +431,47 @@ func Test_getDownloadURL(t *testing.T) { }{ { "simple", - args{&context.Context{Version: "1.0.0", Config: config.Project{Release: config.Release{GitHub: config.Repo{Owner: "user", Name: "repo"}}}}, "https://github.com", "file.tar.gz"}, - "https://github.com/user/repo/releases/download/1.0.0/file.tar.gz", + args{ + &context.Context{ + Version: "1.0.0", + Git: context.GitInfo{ + CurrentTag: "v1.0.0", + }, + Config: config.Project{ + Release: config.Release{ + GitHub: config.Repo{ + Owner: "user", + Name: "repo", + }, + }, + }, + }, + "https://github.com", + "file.tar.gz", + }, + "https://github.com/user/repo/releases/download/v1.0.0/file.tar.gz", }, { "custom", - args{&context.Context{Version: "1.0.0", Config: config.Project{Release: config.Release{GitHub: config.Repo{Owner: "user", Name: "repo"}}}}, "https://git.my.company.com", "file.tar.gz"}, - "https://git.my.company.com/user/repo/releases/download/1.0.0/file.tar.gz", + args{ + &context.Context{ + Version: "1.0.0", + Git: context.GitInfo{ + CurrentTag: "v1.0.0", + }, + Config: config.Project{ + Release: config.Release{ + GitHub: config.Repo{ + Owner: "user", + Name: "repo", + }, + }, + }, + }, + "https://git.my.company.com", + "file.tar.gz", + }, + "https://git.my.company.com/user/repo/releases/download/v1.0.0/file.tar.gz", }, } for _, tt := range tests { diff --git a/pipeline/scoop/testdata/test_buildmanifest.json.golden b/pipeline/scoop/testdata/test_buildmanifest.json.golden index edb8b1cb2..e56b31abd 100644 --- a/pipeline/scoop/testdata/test_buildmanifest.json.golden +++ b/pipeline/scoop/testdata/test_buildmanifest.json.golden @@ -2,11 +2,11 @@ "version": "1.0.1", "architecture": { "32bit": { - "url": "https://github.com/test/test/releases/download/1.0.1/foo_1.0.1_windows_386.tar.gz", + "url": "https://github.com/test/test/releases/download/v1.0.1/foo_1.0.1_windows_386.tar.gz", "bin": "test.exe" }, "64bit": { - "url": "https://github.com/test/test/releases/download/1.0.1/foo_1.0.1_windows_amd64.tar.gz", + "url": "https://github.com/test/test/releases/download/v1.0.1/foo_1.0.1_windows_amd64.tar.gz", "bin": "test.exe" } },