mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-04 03:11:55 +02:00
feat: deprecate brews.tap, krews.index & scoops.bucket (#4099)
It should make goreleaser easier to use, as a `repository` is now always called `repository`. Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
56dfb8b5b0
commit
62b065dad0
@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
@ -67,6 +68,10 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if brew.Plist != "" {
|
||||
deprecate.Notice(ctx, "brews.plist")
|
||||
}
|
||||
if !reflect.DeepEqual(brew.Tap, config.RepoRef{}) {
|
||||
brew.Repository = brew.Tap
|
||||
deprecate.Notice(ctx, "brews.tap")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -131,7 +136,7 @@ func doPublish(ctx *context.Context, formula *artifact.Artifact, cl client.Clien
|
||||
return pipe.Skip("prerelease detected with 'auto' upload, skipping homebrew publish")
|
||||
}
|
||||
|
||||
repo := client.RepoFromRef(brew.Tap)
|
||||
repo := client.RepoFromRef(brew.Repository)
|
||||
|
||||
gpath := buildFormulaPath(brew.Folder, formula.Name)
|
||||
|
||||
@ -150,17 +155,17 @@ func doPublish(ctx *context.Context, formula *artifact.Artifact, cl client.Clien
|
||||
return err
|
||||
}
|
||||
|
||||
if brew.Tap.Git.URL != "" {
|
||||
if brew.Repository.Git.URL != "" {
|
||||
return client.NewGitUploadClient(repo.Branch).
|
||||
CreateFile(ctx, author, repo, content, gpath, msg)
|
||||
}
|
||||
|
||||
cl, err = client.NewIfToken(ctx, cl, brew.Tap.Token)
|
||||
cl, err = client.NewIfToken(ctx, cl, brew.Repository.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !brew.Tap.PullRequest.Enabled {
|
||||
if !brew.Repository.PullRequest.Enabled {
|
||||
return cl.CreateFile(ctx, author, repo, content, gpath, msg)
|
||||
}
|
||||
|
||||
@ -176,15 +181,15 @@ func doPublish(ctx *context.Context, formula *artifact.Artifact, cl client.Clien
|
||||
|
||||
title := fmt.Sprintf("Updated %s to %s", ctx.Config.ProjectName, ctx.Version)
|
||||
return pcl.OpenPullRequest(ctx, client.Repo{
|
||||
Name: brew.Tap.PullRequest.Base.Name,
|
||||
Owner: brew.Tap.PullRequest.Base.Owner,
|
||||
Branch: brew.Tap.PullRequest.Base.Branch,
|
||||
}, repo, title, brew.Tap.PullRequest.Draft)
|
||||
Name: brew.Repository.PullRequest.Base.Name,
|
||||
Owner: brew.Repository.PullRequest.Base.Owner,
|
||||
Branch: brew.Repository.PullRequest.Base.Branch,
|
||||
}, repo, title, brew.Repository.PullRequest.Draft)
|
||||
}
|
||||
|
||||
func doRun(ctx *context.Context, brew config.Homebrew, cl client.ReleaserURLTemplater) error {
|
||||
if brew.Tap.Name == "" {
|
||||
return pipe.Skip("brew tap name is not set")
|
||||
if brew.Repository.Name == "" {
|
||||
return pipe.Skip("brew.repository.name is not set")
|
||||
}
|
||||
|
||||
filters := []artifact.Filter{
|
||||
@ -232,11 +237,11 @@ func doRun(ctx *context.Context, brew config.Homebrew, cl client.ReleaserURLTemp
|
||||
}
|
||||
brew.Name = name
|
||||
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, brew.Tap)
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, brew.Repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
brew.Tap = ref
|
||||
brew.Repository = ref
|
||||
|
||||
skipUpload, err := tmpl.New(ctx).Apply(brew.SkipUpload)
|
||||
if err != nil {
|
||||
|
@ -165,8 +165,8 @@ func TestFullPipe(t *testing.T) {
|
||||
"default": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].Homepage = "https://github.com/goreleaser"
|
||||
},
|
||||
},
|
||||
@ -174,7 +174,7 @@ func TestFullPipe(t *testing.T) {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Brews[0].Homepage = "https://github.com/goreleaser"
|
||||
ctx.Config.Brews[0].Tap = config.RepoRef{
|
||||
ctx.Config.Brews[0].Repository = config.RepoRef{
|
||||
Name: "test",
|
||||
Branch: "main",
|
||||
Git: config.GitRepoRef{
|
||||
@ -188,7 +188,7 @@ func TestFullPipe(t *testing.T) {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Brews[0].Homepage = "https://github.com/goreleaser"
|
||||
ctx.Config.Brews[0].Tap = config.RepoRef{
|
||||
ctx.Config.Brews[0].Repository = config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
Branch: "update-{{.Version}}",
|
||||
@ -201,8 +201,8 @@ func TestFullPipe(t *testing.T) {
|
||||
"custom_download_strategy": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].Homepage = "https://github.com/goreleaser"
|
||||
|
||||
ctx.Config.Brews[0].DownloadStrategy = "GitHubPrivateRepositoryReleaseDownloadStrategy"
|
||||
@ -211,8 +211,8 @@ func TestFullPipe(t *testing.T) {
|
||||
"custom_require": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].Homepage = "https://github.com/goreleaser"
|
||||
|
||||
ctx.Config.Brews[0].DownloadStrategy = "CustomDownloadStrategy"
|
||||
@ -222,8 +222,8 @@ func TestFullPipe(t *testing.T) {
|
||||
"custom_block": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].Homepage = "https://github.com/goreleaser"
|
||||
|
||||
ctx.Config.Brews[0].CustomBlock = `head "https://github.com/caarlos0/test.git"`
|
||||
@ -232,55 +232,55 @@ func TestFullPipe(t *testing.T) {
|
||||
"default_gitlab": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitLab
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].Homepage = "https://gitlab.com/goreleaser"
|
||||
},
|
||||
},
|
||||
"invalid_commit_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].CommitMessageTemplate = "{{ .Asdsa }"
|
||||
},
|
||||
expectedPublishError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"valid_tap_templates": {
|
||||
"valid_repository_templates": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Env = map[string]string{
|
||||
"FOO": "templated",
|
||||
}
|
||||
ctx.Config.Brews[0].Tap.Owner = "{{.Env.FOO}}"
|
||||
ctx.Config.Brews[0].Tap.Name = "{{.Env.FOO}}"
|
||||
ctx.Config.Brews[0].Repository.Owner = "{{.Env.FOO}}"
|
||||
ctx.Config.Brews[0].Repository.Name = "{{.Env.FOO}}"
|
||||
},
|
||||
},
|
||||
"invalid_tap_name_template": {
|
||||
"invalid_repository_name_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "{{ .Asdsa }"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "{{ .Asdsa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid_tap_owner_template": {
|
||||
"invalid_repository_owner_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Brews[0].Tap.Owner = "{{ .Asdsa }"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "{{ .Asdsa }"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid_tap_skip_upload_template": {
|
||||
"invalid_repository_skip_upload_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Brews[0].SkipUpload = "{{ .Asdsa }"
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid_install_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Brews[0].Tap.Owner = "test"
|
||||
ctx.Config.Brews[0].Tap.Name = "test"
|
||||
ctx.Config.Brews[0].Repository.Owner = "test"
|
||||
ctx.Config.Brews[0].Repository.Name = "test"
|
||||
ctx.Config.Brews[0].Install = "{{ .aaaa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
@ -391,7 +391,7 @@ func TestFullPipe(t *testing.T) {
|
||||
require.NoError(t, publishAll(ctx, client))
|
||||
|
||||
content := []byte(client.Content)
|
||||
if url := ctx.Config.Brews[0].Tap.Git.URL; url == "" {
|
||||
if url := ctx.Config.Brews[0].Repository.Git.URL; url == "" {
|
||||
require.True(t, client.CreatedFile, "should have created a file")
|
||||
} else {
|
||||
content = testlib.CatFileFromBareRepository(t, url, name+".rb")
|
||||
@ -419,7 +419,7 @@ func TestRunPipeNameTemplate(t *testing.T) {
|
||||
Homepage: "https://goreleaser.com",
|
||||
Goamd64: "v1",
|
||||
Install: `bin.install "foo"`,
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -472,7 +472,7 @@ func TestRunPipeMultipleBrewsWithSkip(t *testing.T) {
|
||||
{
|
||||
Name: "foo",
|
||||
Goamd64: "v1",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -484,7 +484,7 @@ func TestRunPipeMultipleBrewsWithSkip(t *testing.T) {
|
||||
{
|
||||
Name: "bar",
|
||||
Goamd64: "v1",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -495,7 +495,7 @@ func TestRunPipeMultipleBrewsWithSkip(t *testing.T) {
|
||||
{
|
||||
Name: "foobar",
|
||||
Goamd64: "v1",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -507,7 +507,7 @@ func TestRunPipeMultipleBrewsWithSkip(t *testing.T) {
|
||||
{
|
||||
Name: "baz",
|
||||
Goamd64: "v1",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -580,7 +580,7 @@ func TestRunPipeForMultipleAmd64Versions(t *testing.T) {
|
||||
{
|
||||
Name: name,
|
||||
Description: "Run pipe test formula",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -706,7 +706,7 @@ func TestRunPipeForMultipleArmVersions(t *testing.T) {
|
||||
Dependencies: []config.HomebrewDependency{{Name: "zsh"}, {Name: "bash", Type: "recommended"}},
|
||||
Conflicts: []string{"gtk+", "qt"},
|
||||
Install: `bin.install "{{ .ProjectName }}"`,
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -801,7 +801,7 @@ func TestRunPipeNoBuilds(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Brews: []config.Homebrew{
|
||||
{
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -823,7 +823,7 @@ func TestRunPipeMultipleArchivesSameOsBuild(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Brews: []config.Homebrew{
|
||||
{
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -974,7 +974,7 @@ func TestRunPipeBinaryRelease(t *testing.T) {
|
||||
Name: "foo",
|
||||
Homepage: "https://goreleaser.com",
|
||||
Description: "Fake desc",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -1021,7 +1021,7 @@ func TestRunPipePullRequest(t *testing.T) {
|
||||
Name: "foo",
|
||||
Homepage: "https://goreleaser.com",
|
||||
Description: "Fake desc",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
Branch: "update-{{.Version}}",
|
||||
@ -1070,7 +1070,7 @@ func TestRunPipeNoUpload(t *testing.T) {
|
||||
Release: config.Release{},
|
||||
Brews: []config.Homebrew{
|
||||
{
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -1128,7 +1128,7 @@ func TestRunEmptyTokenType(t *testing.T) {
|
||||
Release: config.Release{},
|
||||
Brews: []config.Homebrew{
|
||||
{
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -1158,11 +1158,32 @@ func TestRunEmptyTokenType(t *testing.T) {
|
||||
|
||||
func TestDefault(t *testing.T) {
|
||||
testlib.Mktmp(t)
|
||||
repo := config.RepoRef{
|
||||
Owner: "owner",
|
||||
Name: "name",
|
||||
Token: "aaa",
|
||||
Branch: "feat",
|
||||
Git: config.GitRepoRef{
|
||||
URL: "git@github.com:foo/bar",
|
||||
SSHCommand: "ssh ",
|
||||
PrivateKey: "/fake",
|
||||
},
|
||||
PullRequest: config.PullRequest{
|
||||
Enabled: true,
|
||||
Base: config.PullRequestBase{
|
||||
Owner: "foo2",
|
||||
Name: "bar2",
|
||||
Branch: "branch2",
|
||||
},
|
||||
Draft: true,
|
||||
},
|
||||
}
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
ProjectName: "myproject",
|
||||
Brews: []config.Homebrew{
|
||||
{
|
||||
Plist: "<xml>... whatever</xml>",
|
||||
Tap: repo,
|
||||
},
|
||||
},
|
||||
}, testctx.GitHubTokenType)
|
||||
@ -1171,6 +1192,7 @@ func TestDefault(t *testing.T) {
|
||||
require.NotEmpty(t, ctx.Config.Brews[0].CommitAuthor.Name)
|
||||
require.NotEmpty(t, ctx.Config.Brews[0].CommitAuthor.Email)
|
||||
require.NotEmpty(t, ctx.Config.Brews[0].CommitMessageTemplate)
|
||||
require.Equal(t, repo, ctx.Config.Brews[0].Repository)
|
||||
require.True(t, ctx.Deprecated)
|
||||
}
|
||||
|
||||
@ -1283,7 +1305,7 @@ func TestRunPipeUniversalBinary(t *testing.T) {
|
||||
Name: "unibin",
|
||||
Homepage: "https://goreleaser.com",
|
||||
Description: "Fake desc",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "unibin",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -1338,7 +1360,7 @@ func TestRunPipeUniversalBinaryNotReplacing(t *testing.T) {
|
||||
Name: "unibin",
|
||||
Homepage: "https://goreleaser.com",
|
||||
Description: "Fake desc",
|
||||
Tap: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "unibin",
|
||||
Name: "bar",
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This file was generated by GoReleaser. DO NOT EDIT.
|
||||
class ValidTapTemplates < Formula
|
||||
class ValidRepositoryTemplates < Formula
|
||||
desc "Run pipe test formula and FOO=templated"
|
||||
homepage ""
|
||||
version "1.0.1"
|
||||
@ -17,7 +17,7 @@ class ValidTapTemplates < Formula
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "valid_tap_templates_darwin_amd64 => valid_tap_templates"
|
||||
bin.install "valid_repository_templates_darwin_amd64 => valid_repository_templates"
|
||||
end
|
||||
end
|
||||
if Hardware::CPU.arm?
|
||||
@ -25,7 +25,7 @@ class ValidTapTemplates < Formula
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "valid_tap_templates_darwin_arm64 => valid_tap_templates"
|
||||
bin.install "valid_repository_templates_darwin_arm64 => valid_repository_templates"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -36,7 +36,7 @@ class ValidTapTemplates < Formula
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
|
||||
def install
|
||||
bin.install "valid_tap_templates_linux_amd64 => valid_tap_templates"
|
||||
bin.install "valid_repository_templates_linux_amd64 => valid_repository_templates"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -51,7 +51,7 @@ class ValidTapTemplates < Formula
|
||||
|
||||
def caveats
|
||||
<<~EOS
|
||||
don't do this valid_tap_templates
|
||||
don't do this valid_repository_templates
|
||||
EOS
|
||||
end
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@ -17,6 +18,7 @@ import (
|
||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||
"github.com/goreleaser/goreleaser/internal/client"
|
||||
"github.com/goreleaser/goreleaser/internal/commitauthor"
|
||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||
"github.com/goreleaser/goreleaser/internal/yaml"
|
||||
@ -53,6 +55,10 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if krew.Goamd64 == "" {
|
||||
krew.Goamd64 = "v1"
|
||||
}
|
||||
if !reflect.DeepEqual(krew.Index, config.RepoRef{}) {
|
||||
krew.Repository = krew.Index
|
||||
deprecate.Notice(ctx, "krews.index")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -306,12 +312,12 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
|
||||
return pipe.Skip("prerelease detected with 'auto' upload, skipping krew publish")
|
||||
}
|
||||
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, cfg.Index)
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, cfg.Repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.Index = ref
|
||||
repo := client.RepoFromRef(cfg.Index)
|
||||
cfg.Repository = ref
|
||||
repo := client.RepoFromRef(cfg.Repository)
|
||||
gpath := buildManifestPath(manifestsFolder, manifest.Name)
|
||||
|
||||
msg, err := tmpl.New(ctx).Apply(cfg.CommitMessageTemplate)
|
||||
@ -329,17 +335,17 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Index.Git.URL != "" {
|
||||
if cfg.Repository.Git.URL != "" {
|
||||
return client.NewGitUploadClient(repo.Branch).
|
||||
CreateFile(ctx, author, repo, content, gpath, msg)
|
||||
}
|
||||
|
||||
cl, err = client.NewIfToken(ctx, cl, cfg.Index.Token)
|
||||
cl, err = client.NewIfToken(ctx, cl, cfg.Repository.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !cfg.Index.PullRequest.Enabled {
|
||||
if !cfg.Repository.PullRequest.Enabled {
|
||||
return cl.CreateFile(ctx, author, repo, content, gpath, msg)
|
||||
}
|
||||
|
||||
@ -355,10 +361,10 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
|
||||
|
||||
title := fmt.Sprintf("Updated %s to %s", ctx.Config.ProjectName, ctx.Version)
|
||||
return pcl.OpenPullRequest(ctx, client.Repo{
|
||||
Name: cfg.Index.PullRequest.Base.Name,
|
||||
Owner: cfg.Index.PullRequest.Base.Owner,
|
||||
Branch: cfg.Index.PullRequest.Base.Branch,
|
||||
}, repo, title, cfg.Index.PullRequest.Draft)
|
||||
Name: cfg.Repository.PullRequest.Base.Name,
|
||||
Owner: cfg.Repository.PullRequest.Base.Owner,
|
||||
Branch: cfg.Repository.PullRequest.Base.Branch,
|
||||
}, repo, title, cfg.Repository.PullRequest.Draft)
|
||||
}
|
||||
|
||||
func buildManifestPath(folder, filename string) string {
|
||||
|
@ -138,8 +138,8 @@ func TestFullPipe(t *testing.T) {
|
||||
"default": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Homepage = "https://github.com/goreleaser"
|
||||
},
|
||||
},
|
||||
@ -147,7 +147,7 @@ func TestFullPipe(t *testing.T) {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitHub
|
||||
ctx.Config.Krews[0].Homepage = "https://github.com/goreleaser"
|
||||
ctx.Config.Krews[0].Index = config.RepoRef{
|
||||
ctx.Config.Krews[0].Repository = config.RepoRef{
|
||||
Name: "test",
|
||||
Branch: "main",
|
||||
Git: config.GitRepoRef{
|
||||
@ -160,63 +160,63 @@ func TestFullPipe(t *testing.T) {
|
||||
"default_gitlab": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.TokenType = context.TokenTypeGitLab
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Homepage = "https://gitlab.com/goreleaser"
|
||||
},
|
||||
},
|
||||
"invalid_commit_template": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].CommitMessageTemplate = "{{ .Asdsa }"
|
||||
},
|
||||
expectedPublishError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid desc": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Description = "{{ .Asdsa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid short desc": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].ShortDescription = "{{ .Asdsa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid homepage": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Homepage = "{{ .Asdsa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid name": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Name = "{{ .Asdsa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"invalid caveats": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Caveats = "{{ .Asdsa }"
|
||||
},
|
||||
expectedRunError: `template: tmpl:1: unexpected "}" in operand`,
|
||||
},
|
||||
"no short desc": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Description = "lalala"
|
||||
ctx.Config.Krews[0].ShortDescription = ""
|
||||
},
|
||||
@ -224,8 +224,8 @@ func TestFullPipe(t *testing.T) {
|
||||
},
|
||||
"no desc": {
|
||||
prepare: func(ctx *context.Context) {
|
||||
ctx.Config.Krews[0].Index.Owner = "test"
|
||||
ctx.Config.Krews[0].Index.Name = "test"
|
||||
ctx.Config.Krews[0].Repository.Owner = "test"
|
||||
ctx.Config.Krews[0].Repository.Name = "test"
|
||||
ctx.Config.Krews[0].Description = ""
|
||||
ctx.Config.Krews[0].ShortDescription = "lalala"
|
||||
},
|
||||
@ -316,7 +316,7 @@ func TestFullPipe(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
content := []byte(client.Content)
|
||||
if url := ctx.Config.Krews[0].Index.Git.URL; url == "" {
|
||||
if url := ctx.Config.Krews[0].Repository.Git.URL; url == "" {
|
||||
require.True(t, client.CreatedFile, "should have created a file")
|
||||
} else {
|
||||
content = testlib.CatFileFromBareRepository(t, url, "plugins/"+name+".yaml")
|
||||
@ -344,7 +344,7 @@ func TestRunPipePullRequest(t *testing.T) {
|
||||
Homepage: "https://goreleaser.com",
|
||||
ShortDescription: "test",
|
||||
Description: "Fake desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
Branch: "update-{{.Version}}",
|
||||
@ -397,7 +397,7 @@ func TestRunPipeUniversalBinary(t *testing.T) {
|
||||
Name: manifestName(t),
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "unibin",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -453,7 +453,7 @@ func TestRunPipeUniversalBinaryNotReplacing(t *testing.T) {
|
||||
Name: manifestName(t),
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "unibin",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -535,7 +535,7 @@ func TestRunPipeNameTemplate(t *testing.T) {
|
||||
Name: "{{ .Env.FOO_BAR }}",
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -592,7 +592,7 @@ func TestRunPipeMultipleKrewWithSkip(t *testing.T) {
|
||||
Name: "foo",
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -605,7 +605,7 @@ func TestRunPipeMultipleKrewWithSkip(t *testing.T) {
|
||||
Name: "bar",
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -617,7 +617,7 @@ func TestRunPipeMultipleKrewWithSkip(t *testing.T) {
|
||||
Name: "foobar",
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
@ -687,7 +687,7 @@ func TestRunPipeForMultipleArmVersions(t *testing.T) {
|
||||
Name: name,
|
||||
ShortDescription: "Short desc",
|
||||
Description: "A run pipe test krew manifest and FOO={{ .Env.FOO }}",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -789,7 +789,7 @@ func TestRunPipeNoBuilds(t *testing.T) {
|
||||
Name: manifestName(t),
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -812,7 +812,7 @@ func TestRunPipeNoUpload(t *testing.T) {
|
||||
Name: manifestName(t),
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -868,7 +868,7 @@ func TestRunEmptyTokenType(t *testing.T) {
|
||||
Name: manifestName(t),
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -908,7 +908,7 @@ func TestRunMultipleBinaries(t *testing.T) {
|
||||
Name: manifestName(t),
|
||||
Description: "Some desc",
|
||||
ShortDescription: "Short desc",
|
||||
Index: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -943,7 +943,13 @@ func TestDefault(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
ProjectName: "myproject",
|
||||
Krews: []config.Krew{
|
||||
{},
|
||||
{
|
||||
Index: config.RepoRef{
|
||||
Git: config.GitRepoRef{
|
||||
URL: "foo/bar",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, testctx.GitHubTokenType)
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
@ -951,6 +957,8 @@ func TestDefault(t *testing.T) {
|
||||
require.NotEmpty(t, ctx.Config.Krews[0].CommitAuthor.Name)
|
||||
require.NotEmpty(t, ctx.Config.Krews[0].CommitAuthor.Email)
|
||||
require.NotEmpty(t, ctx.Config.Krews[0].CommitMessageTemplate)
|
||||
require.Equal(t, "foo/bar", ctx.Config.Krews[0].Repository.Git.URL)
|
||||
require.True(t, ctx.Deprecated)
|
||||
}
|
||||
|
||||
func TestGHFolder(t *testing.T) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Package scoop provides a Pipe that generates a scoop.sh App Manifest and pushes it to a bucket
|
||||
// Package scoop provides a Pipe that generates a scoop.sh App Manifest and pushes it to a bucket.
|
||||
package scoop
|
||||
|
||||
import (
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/caarlos0/log"
|
||||
@ -60,7 +61,7 @@ type Pipe struct{}
|
||||
|
||||
func (Pipe) String() string { return "scoop manifests" }
|
||||
func (Pipe) Skip(ctx *context.Context) bool {
|
||||
return ctx.Config.Scoop.Bucket.Name == "" && len(ctx.Config.Scoops) == 0
|
||||
return ctx.Config.Scoop.Repository.Name == "" && len(ctx.Config.Scoops) == 0
|
||||
}
|
||||
|
||||
// Run creates the scoop manifest locally.
|
||||
@ -83,7 +84,8 @@ func (Pipe) Publish(ctx *context.Context) error {
|
||||
|
||||
// Default sets the pipe defaults.
|
||||
func (Pipe) Default(ctx *context.Context) error {
|
||||
if ctx.Config.Scoop.Bucket.Name != "" {
|
||||
if !reflect.DeepEqual(ctx.Config.Scoop.Bucket, config.RepoRef{}) ||
|
||||
!reflect.DeepEqual(ctx.Config.Scoop.Repository, config.RepoRef{}) {
|
||||
deprecate.Notice(ctx, "scoop")
|
||||
ctx.Config.Scoops = append(ctx.Config.Scoops, ctx.Config.Scoop)
|
||||
}
|
||||
@ -99,6 +101,10 @@ func (Pipe) Default(ctx *context.Context) error {
|
||||
if scoop.Goamd64 == "" {
|
||||
scoop.Goamd64 = "v1"
|
||||
}
|
||||
if !reflect.DeepEqual(scoop.Bucket, config.RepoRef{}) {
|
||||
scoop.Repository = scoop.Bucket
|
||||
deprecate.Notice(ctx, "scoops.bucket")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -161,11 +167,11 @@ func doRun(ctx *context.Context, scoop config.Scoop, cl client.ReleaserURLTempla
|
||||
}
|
||||
scoop.Homepage = homepage
|
||||
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, scoop.Bucket)
|
||||
ref, err := client.TemplateRef(tmpl.New(ctx).Apply, scoop.Repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
scoop.Bucket = ref
|
||||
scoop.Repository = ref
|
||||
|
||||
skipUpload, err := tmpl.New(ctx).Apply(scoop.SkipUpload)
|
||||
if err != nil {
|
||||
@ -254,20 +260,20 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
|
||||
return err
|
||||
}
|
||||
|
||||
repo := client.RepoFromRef(scoop.Bucket)
|
||||
repo := client.RepoFromRef(scoop.Repository)
|
||||
gpath := path.Join(scoop.Folder, manifest.Name)
|
||||
|
||||
if scoop.Bucket.Git.URL != "" {
|
||||
if scoop.Repository.Git.URL != "" {
|
||||
return client.NewGitUploadClient(repo.Branch).
|
||||
CreateFile(ctx, author, repo, content, gpath, commitMessage)
|
||||
}
|
||||
|
||||
cl, err = client.NewIfToken(ctx, cl, scoop.Bucket.Token)
|
||||
cl, err = client.NewIfToken(ctx, cl, scoop.Repository.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !scoop.Bucket.PullRequest.Enabled {
|
||||
if !scoop.Repository.PullRequest.Enabled {
|
||||
return cl.CreateFile(ctx, author, repo, content, gpath, commitMessage)
|
||||
}
|
||||
|
||||
@ -283,10 +289,10 @@ func doPublish(ctx *context.Context, manifest *artifact.Artifact, cl client.Clie
|
||||
|
||||
title := fmt.Sprintf("Updated %s to %s", ctx.Config.ProjectName, ctx.Version)
|
||||
return pcl.OpenPullRequest(ctx, client.Repo{
|
||||
Name: scoop.Bucket.PullRequest.Base.Name,
|
||||
Owner: scoop.Bucket.PullRequest.Base.Owner,
|
||||
Branch: scoop.Bucket.PullRequest.Base.Branch,
|
||||
}, repo, title, scoop.Bucket.PullRequest.Draft)
|
||||
Name: scoop.Repository.PullRequest.Base.Name,
|
||||
Owner: scoop.Repository.PullRequest.Base.Owner,
|
||||
Branch: scoop.Repository.PullRequest.Base.Branch,
|
||||
}, repo, title, scoop.Repository.PullRequest.Draft)
|
||||
}
|
||||
|
||||
// Manifest represents a scoop.sh App Manifest.
|
||||
|
@ -28,7 +28,7 @@ func TestDefault(t *testing.T) {
|
||||
ProjectName: "barr",
|
||||
Scoops: []config.Scoop{
|
||||
{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Name: "foo",
|
||||
},
|
||||
},
|
||||
@ -64,6 +64,8 @@ func TestDefaultDeprecated(t *testing.T) {
|
||||
require.NotEmpty(t, ctx.Config.Scoops[0].CommitAuthor.Name)
|
||||
require.NotEmpty(t, ctx.Config.Scoops[0].CommitAuthor.Email)
|
||||
require.NotEmpty(t, ctx.Config.Scoops[0].CommitMessageTemplate)
|
||||
require.Equal(t, "foo", ctx.Config.Scoops[0].Repository.Name)
|
||||
require.True(t, ctx.Deprecated)
|
||||
}
|
||||
|
||||
func Test_doRun(t *testing.T) {
|
||||
@ -109,7 +111,7 @@ func Test_doRun(t *testing.T) {
|
||||
Dist: t.TempDir(),
|
||||
ProjectName: "multi-arts",
|
||||
Scoops: []config.Scoop{{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -149,7 +151,7 @@ func Test_doRun(t *testing.T) {
|
||||
Dist: t.TempDir(),
|
||||
ProjectName: "multi-bins",
|
||||
Scoops: []config.Scoop{{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -191,7 +193,7 @@ func Test_doRun(t *testing.T) {
|
||||
Dist: t.TempDir(),
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -226,7 +228,7 @@ func Test_doRun(t *testing.T) {
|
||||
ProjectName: "git-run-pipe",
|
||||
Dist: t.TempDir(),
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Name: "test",
|
||||
Branch: "main",
|
||||
Git: config.GitRepoRef{
|
||||
@ -255,7 +257,7 @@ func Test_doRun(t *testing.T) {
|
||||
tb.Helper()
|
||||
content := testlib.CatFileFromBareRepository(
|
||||
tb,
|
||||
a.ctx.Config.Scoop.Bucket.Git.URL,
|
||||
a.ctx.Config.Scoop.Repository.Git.URL,
|
||||
"scoops/git-run-pipe.json",
|
||||
)
|
||||
golden.RequireEqualJSON(tb, content)
|
||||
@ -268,7 +270,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -315,7 +317,7 @@ func Test_doRun(t *testing.T) {
|
||||
GitHubURLs: config.GitHubURLs{Download: "https://api.custom.github.enterprise.com"},
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -347,7 +349,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -388,7 +390,7 @@ func Test_doRun(t *testing.T) {
|
||||
GitHubURLs: config.GitHubURLs{Download: "https://api.custom.gitlab.enterprise.com"},
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -428,7 +430,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -455,7 +457,7 @@ func Test_doRun(t *testing.T) {
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
SkipUpload: "auto",
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -486,7 +488,7 @@ func Test_doRun(t *testing.T) {
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
SkipUpload: "true",
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -518,7 +520,7 @@ func Test_doRun(t *testing.T) {
|
||||
Disable: "true",
|
||||
},
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -547,7 +549,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -573,7 +575,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -600,7 +602,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -627,7 +629,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -654,7 +656,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -681,7 +683,7 @@ func Test_doRun(t *testing.T) {
|
||||
config.Project{
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "{{ .Env.aaaaaa }}",
|
||||
Name: "test",
|
||||
},
|
||||
@ -711,7 +713,7 @@ func Test_doRun(t *testing.T) {
|
||||
Env: []string{"FOO=test", "BRANCH=main"},
|
||||
ProjectName: "run-pipe",
|
||||
Scoops: []config.Scoop{{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "{{ .Env.FOO }}",
|
||||
Name: "{{ .Env.FOO }}",
|
||||
Branch: "{{ .Env.BRANCH }}",
|
||||
@ -767,7 +769,7 @@ func TestRunPipePullRequest(t *testing.T) {
|
||||
Name: "{{.Env.FOO}}",
|
||||
Homepage: "https://{{.Env.FOO}}.com",
|
||||
Description: "Fake desc for {{.ProjectName}}",
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "foo",
|
||||
Name: "bar",
|
||||
Branch: "update-{{.Version}}",
|
||||
@ -832,7 +834,7 @@ func Test_buildManifest(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -861,7 +863,7 @@ func Test_buildManifest(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -886,7 +888,7 @@ func Test_buildManifest(t *testing.T) {
|
||||
},
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -911,7 +913,7 @@ func Test_buildManifest(t *testing.T) {
|
||||
},
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -994,7 +996,7 @@ func getScoopPipeSkipCtx(folder string) (*context.Context, string) {
|
||||
Dist: folder,
|
||||
ProjectName: "run-pipe",
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -1068,7 +1070,7 @@ func TestWrapInDirectory(t *testing.T) {
|
||||
},
|
||||
ProjectName: "run-pipe",
|
||||
Scoops: []config.Scoop{{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Owner: "test",
|
||||
Name: "test",
|
||||
},
|
||||
@ -1118,7 +1120,7 @@ func TestSkip(t *testing.T) {
|
||||
t.Run("dont skip", func(t *testing.T) {
|
||||
ctx := testctx.NewWithCfg(config.Project{
|
||||
Scoop: config.Scoop{
|
||||
Bucket: config.RepoRef{
|
||||
Repository: config.RepoRef{
|
||||
Name: "a",
|
||||
},
|
||||
},
|
||||
|
@ -217,7 +217,8 @@ type AUR struct {
|
||||
// Homebrew contains the brew section.
|
||||
type Homebrew struct {
|
||||
Name string `yaml:"name,omitempty" json:"name,omitempty"`
|
||||
Tap RepoRef `yaml:"tap,omitempty" json:"tap,omitempty"`
|
||||
Tap RepoRef `yaml:"tap,omitempty" json:"tap,omitempty"` // Deprecated
|
||||
Repository RepoRef `yaml:"repository,omitempty" json:"repository,omitempty"`
|
||||
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
|
||||
CommitMessageTemplate string `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
|
||||
Folder string `yaml:"folder,omitempty" json:"folder,omitempty"`
|
||||
@ -263,7 +264,8 @@ type Nix struct {
|
||||
type Krew struct {
|
||||
IDs []string `yaml:"ids,omitempty" json:"ids,omitempty"`
|
||||
Name string `yaml:"name,omitempty" json:"name,omitempty"`
|
||||
Index RepoRef `yaml:"index,omitempty" json:"index,omitempty"`
|
||||
Index RepoRef `yaml:"index,omitempty" json:"index,omitempty"` // Deprecated
|
||||
Repository RepoRef `yaml:"repository,omitempty" json:"repository,omitempty"`
|
||||
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
|
||||
CommitMessageTemplate string `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
|
||||
Caveats string `yaml:"caveats,omitempty" json:"caveats,omitempty"`
|
||||
@ -302,7 +304,8 @@ type Ko struct {
|
||||
type Scoop struct {
|
||||
Name string `yaml:"name,omitempty" json:"name,omitempty"`
|
||||
IDs []string `yaml:"ids,omitempty" json:"ids,omitempty"`
|
||||
Bucket RepoRef `yaml:"bucket,omitempty" json:"bucket,omitempty"`
|
||||
Bucket RepoRef `yaml:"bucket,omitempty" json:"bucket,omitempty"` // Deprecated
|
||||
Repository RepoRef `yaml:"repository,omitempty" json:"repository,omitempty"`
|
||||
Folder string `yaml:"folder,omitempty" json:"folder,omitempty"`
|
||||
CommitAuthor CommitAuthor `yaml:"commit_author,omitempty" json:"commit_author,omitempty"`
|
||||
CommitMessageTemplate string `yaml:"commit_msg_template,omitempty" json:"commit_msg_template,omitempty"`
|
||||
@ -573,7 +576,7 @@ func (f File) JSONSchema() *jsonschema.Schema {
|
||||
|
||||
// UniversalBinary setups macos universal binaries.
|
||||
type UniversalBinary struct {
|
||||
ID string `yaml:"id,omitempty" json:"id,omitempty"` // deprecated
|
||||
ID string `yaml:"id,omitempty" json:"id,omitempty"` // Deprecated
|
||||
IDs []string `yaml:"ids,omitempty" json:"ids,omitempty"`
|
||||
NameTemplate string `yaml:"name_template,omitempty" json:"name_template,omitempty"`
|
||||
Replace bool `yaml:"replace,omitempty" json:"replace,omitempty"`
|
||||
@ -1036,7 +1039,7 @@ type Project struct {
|
||||
AURs []AUR `yaml:"aurs,omitempty" json:"aurs,omitempty"`
|
||||
Krews []Krew `yaml:"krews,omitempty" json:"krews,omitempty"`
|
||||
Kos []Ko `yaml:"kos,omitempty" json:"kos,omitempty"`
|
||||
Scoop Scoop `yaml:"scoop,omitempty" json:"scoop,omitempty"` // deprecated
|
||||
Scoop Scoop `yaml:"scoop,omitempty" json:"scoop,omitempty"` // Deprecated
|
||||
Scoops []Scoop `yaml:"scoops,omitempty" json:"scoops,omitempty"`
|
||||
Builds []Build `yaml:"builds,omitempty" json:"builds,omitempty"`
|
||||
Archives []Archive `yaml:"archives,omitempty" json:"archives,omitempty"`
|
||||
@ -1068,7 +1071,7 @@ type Project struct {
|
||||
UPXs []UPX `yaml:"upx,omitempty" json:"upx,omitempty"`
|
||||
|
||||
// this is a hack ¯\_(ツ)_/¯
|
||||
SingleBuild Build `yaml:"build,omitempty" json:"build,omitempty" jsonschema_description:"deprecated: use builds instead"` // deprecated
|
||||
SingleBuild Build `yaml:"build,omitempty" json:"build,omitempty" jsonschema_description:"deprecated: use builds instead"` // Deprecated
|
||||
|
||||
// force the SCM token to use when multiple are set
|
||||
ForceToken string `yaml:"force_token,omitempty" json:"force_token,omitempty" jsonschema:"enum=github,enum=gitlab,enum=gitea,enum=,default="`
|
||||
|
@ -150,8 +150,6 @@ brews:
|
||||
etc.install "app-config.conf"
|
||||
# ...
|
||||
|
||||
# GitHub/GitLab repository to push the formula to
|
||||
tap:
|
||||
{% include-markdown "../includes/repository.md" comments=false %}
|
||||
```
|
||||
|
||||
|
@ -82,8 +82,6 @@ krews:
|
||||
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
|
||||
skip_upload: true
|
||||
|
||||
# GitHub/GitLab repository to push the Krew plugin to.
|
||||
index:
|
||||
{% include-markdown "../includes/repository.md" comments=false %}
|
||||
```
|
||||
|
||||
|
@ -87,8 +87,6 @@ nix:
|
||||
post_install: |
|
||||
installShellCompletion ./completions/*
|
||||
|
||||
# GitHub/GitLab repository to push the pkg to.
|
||||
repository:
|
||||
{% include-markdown "../includes/repository.md" comments=false %}
|
||||
```
|
||||
|
||||
|
@ -92,8 +92,6 @@ scoops:
|
||||
# Default: 'v1'
|
||||
goamd64: v3
|
||||
|
||||
# Repository to push the app manifest to.
|
||||
bucket:
|
||||
{% include-markdown "../includes/repository.md" comments=false %}
|
||||
```
|
||||
|
||||
|
@ -37,6 +37,84 @@ Description.
|
||||
|
||||
-->
|
||||
|
||||
### scoops.bucket
|
||||
|
||||
> since 2023-06-13 (v1.19.0)
|
||||
|
||||
Replace `index` with `repository`.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
scoops:
|
||||
-
|
||||
bucket:
|
||||
- name: foo
|
||||
owner: bar
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
scoops:
|
||||
-
|
||||
repository:
|
||||
- name: foo
|
||||
owner: bar
|
||||
```
|
||||
|
||||
### krews.index
|
||||
|
||||
> since 2023-06-13 (v1.19.0)
|
||||
|
||||
Replace `index` with `repository`.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
krews:
|
||||
-
|
||||
index:
|
||||
- name: foo
|
||||
owner: bar
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
krews:
|
||||
-
|
||||
repository:
|
||||
- name: foo
|
||||
owner: bar
|
||||
```
|
||||
|
||||
### brews.tap
|
||||
|
||||
> since 2023-06-13 (v1.19.0)
|
||||
|
||||
Replace `tap` with `repository`.
|
||||
|
||||
=== "Before"
|
||||
|
||||
```yaml
|
||||
brews:
|
||||
-
|
||||
tap:
|
||||
- name: foo
|
||||
owner: bar
|
||||
```
|
||||
|
||||
=== "After"
|
||||
|
||||
```yaml
|
||||
brews:
|
||||
-
|
||||
repository:
|
||||
- name: foo
|
||||
owner: bar
|
||||
```
|
||||
|
||||
### archives.rlcp
|
||||
|
||||
> since 2023-06-06 (v1.19.0)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Repository to push the generated files to.
|
||||
repository:
|
||||
# Repository owner.
|
||||
#
|
||||
# Templates: allowed
|
||||
|
Loading…
Reference in New Issue
Block a user