mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-11 11:42:15 +02:00
feat: remove singular snapcraft config (#1281)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
885a9710e5
commit
468401bc54
@ -7,12 +7,13 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/apex/log"
|
"github.com/apex/log"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||||
"github.com/goreleaser/goreleaser/internal/deprecate"
|
|
||||||
"github.com/goreleaser/goreleaser/internal/ids"
|
"github.com/goreleaser/goreleaser/internal/ids"
|
||||||
"github.com/goreleaser/goreleaser/internal/linux"
|
"github.com/goreleaser/goreleaser/internal/linux"
|
||||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||||
@ -20,8 +21,6 @@ import (
|
|||||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||||
"github.com/goreleaser/goreleaser/pkg/config"
|
"github.com/goreleaser/goreleaser/pkg/config"
|
||||||
"github.com/goreleaser/goreleaser/pkg/context"
|
"github.com/goreleaser/goreleaser/pkg/context"
|
||||||
"github.com/pkg/errors"
|
|
||||||
yaml "gopkg.in/yaml.v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrNoSnapcraft is shown when snapcraft cannot be found in $PATH
|
// ErrNoSnapcraft is shown when snapcraft cannot be found in $PATH
|
||||||
@ -67,12 +66,6 @@ func (Pipe) String() string {
|
|||||||
|
|
||||||
// Default sets the pipe defaults
|
// Default sets the pipe defaults
|
||||||
func (Pipe) Default(ctx *context.Context) error {
|
func (Pipe) Default(ctx *context.Context) error {
|
||||||
if len(ctx.Config.Snapcrafts) == 0 {
|
|
||||||
ctx.Config.Snapcrafts = append(ctx.Config.Snapcrafts, ctx.Config.Snapcraft)
|
|
||||||
if !reflect.DeepEqual(ctx.Config.Snapcraft, config.Snapcraft{}) {
|
|
||||||
deprecate.Notice("snapcraft")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var ids = ids.New("snapcrafts")
|
var ids = ids.New("snapcrafts")
|
||||||
for i := range ctx.Config.Snapcrafts {
|
for i := range ctx.Config.Snapcrafts {
|
||||||
var snap = &ctx.Config.Snapcrafts[i]
|
var snap = &ctx.Config.Snapcrafts[i]
|
||||||
|
@ -326,6 +326,9 @@ func TestDefault(t *testing.T) {
|
|||||||
ID: "foo",
|
ID: "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Snapcrafts: []config.Snapcraft{
|
||||||
|
{},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
assert.NoError(t, Pipe{}.Default(ctx))
|
assert.NoError(t, Pipe{}.Default(ctx))
|
||||||
assert.Equal(t, defaultNameTemplate, ctx.Config.Snapcrafts[0].NameTemplate)
|
assert.Equal(t, defaultNameTemplate, ctx.Config.Snapcrafts[0].NameTemplate)
|
||||||
@ -357,16 +360,6 @@ func TestDefaultSet(t *testing.T) {
|
|||||||
assert.Equal(t, "foo", ctx.Config.Snapcrafts[0].NameTemplate)
|
assert.Equal(t, "foo", ctx.Config.Snapcrafts[0].NameTemplate)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDefaultDeprecate(t *testing.T) {
|
|
||||||
var ctx = context.New(config.Project{
|
|
||||||
Snapcraft: config.Snapcraft{
|
|
||||||
NameTemplate: "foo",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
assert.NoError(t, Pipe{}.Default(ctx))
|
|
||||||
assert.Equal(t, "foo", ctx.Config.Snapcrafts[0].NameTemplate)
|
|
||||||
}
|
|
||||||
|
|
||||||
func addBinaries(t *testing.T, ctx *context.Context, name, dist, dest string) {
|
func addBinaries(t *testing.T, ctx *context.Context, name, dist, dest string) {
|
||||||
for _, goos := range []string{"linux", "darwin"} {
|
for _, goos := range []string{"linux", "darwin"} {
|
||||||
for _, goarch := range []string{"amd64", "386", "arm6"} {
|
for _, goarch := range []string{"amd64", "386", "arm6"} {
|
||||||
|
@ -361,7 +361,6 @@ type Project struct {
|
|||||||
Archive Archive `yaml:",omitempty"` // TODO: remove this
|
Archive Archive `yaml:",omitempty"` // TODO: remove this
|
||||||
Archives []Archive `yaml:",omitempty"`
|
Archives []Archive `yaml:",omitempty"`
|
||||||
NFPMs []NFPM `yaml:"nfpms,omitempty"`
|
NFPMs []NFPM `yaml:"nfpms,omitempty"`
|
||||||
Snapcraft Snapcraft `yaml:",omitempty"` // TODO: remove this
|
|
||||||
Snapcrafts []Snapcraft `yaml:",omitempty"`
|
Snapcrafts []Snapcraft `yaml:",omitempty"`
|
||||||
Snapshot Snapshot `yaml:",omitempty"`
|
Snapshot Snapshot `yaml:",omitempty"`
|
||||||
Checksum Checksum `yaml:",omitempty"`
|
Checksum Checksum `yaml:",omitempty"`
|
||||||
|
@ -175,29 +175,6 @@ blobs:
|
|||||||
# etc
|
# etc
|
||||||
```
|
```
|
||||||
|
|
||||||
### snapcraft
|
|
||||||
|
|
||||||
> since 2019-05-27
|
|
||||||
|
|
||||||
We now allow multiple Snapcraft configs, so the `snapcraft` statement will be removed.
|
|
||||||
|
|
||||||
Change this:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
snapcraft:
|
|
||||||
publish: true
|
|
||||||
# ...
|
|
||||||
```
|
|
||||||
|
|
||||||
to this:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
snapcrafts:
|
|
||||||
-
|
|
||||||
publish: true
|
|
||||||
# ...
|
|
||||||
```
|
|
||||||
|
|
||||||
### archive
|
### archive
|
||||||
|
|
||||||
> since 2019-04-16
|
> since 2019-04-16
|
||||||
@ -223,6 +200,30 @@ archives:
|
|||||||
|
|
||||||
The following options were deprecated for ~6 months and are now fully removed.
|
The following options were deprecated for ~6 months and are now fully removed.
|
||||||
|
|
||||||
|
|
||||||
|
### snapcraft
|
||||||
|
|
||||||
|
> since 2019-05-27, removed 2019-12-27
|
||||||
|
|
||||||
|
We now allow multiple Snapcraft configs, so the `snapcraft` statement will be removed.
|
||||||
|
|
||||||
|
Change this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
snapcraft:
|
||||||
|
publish: true
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
|
to this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
snapcrafts:
|
||||||
|
-
|
||||||
|
publish: true
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
### nfpm
|
### nfpm
|
||||||
|
|
||||||
> since 2019-05-07, removed 2019-12-27
|
> since 2019-05-07, removed 2019-12-27
|
||||||
|
Loading…
x
Reference in New Issue
Block a user