mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
feat: add base key to snapcraft (#1011)
This commit is contained in:
parent
3da2b375c9
commit
2b8258f003
@ -35,6 +35,7 @@ type Metadata struct {
|
||||
Version string
|
||||
Summary string
|
||||
Description string
|
||||
Base string `yaml:",omitempty"`
|
||||
License string `yaml:",omitempty"`
|
||||
Grade string `yaml:",omitempty"`
|
||||
Confinement string `yaml:",omitempty"`
|
||||
@ -147,6 +148,10 @@ func create(ctx *context.Context, arch string, binaries []artifact.Artifact) err
|
||||
Apps: map[string]AppMetadata{},
|
||||
}
|
||||
|
||||
if ctx.Config.Snapcraft.Base != "" {
|
||||
metadata.Base = ctx.Config.Snapcraft.Base
|
||||
}
|
||||
|
||||
if ctx.Config.Snapcraft.License != "" {
|
||||
metadata.License = ctx.Config.Snapcraft.License
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ func TestRunPipeWithName(t *testing.T) {
|
||||
Snapcraft: config.Snapcraft{
|
||||
NameTemplate: "foo_{{.Arch}}",
|
||||
Name: "testsnapname",
|
||||
Base: "core18",
|
||||
License: "MIT",
|
||||
Summary: "test summary",
|
||||
Description: "test description",
|
||||
@ -111,6 +112,7 @@ func TestRunPipeWithName(t *testing.T) {
|
||||
err = yaml.Unmarshal(yamlFile, &metadata)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "testsnapname", metadata.Name)
|
||||
assert.Equal(t, "core18", metadata.Base)
|
||||
assert.Equal(t, "MIT", metadata.License)
|
||||
assert.Equal(t, "mybin", metadata.Apps["mybin"].Command)
|
||||
assert.Equal(t, "mybin", metadata.Apps["testsnapname"].Command)
|
||||
@ -142,6 +144,7 @@ func TestRunPipeWithBinaryInDir(t *testing.T) {
|
||||
err = yaml.Unmarshal(yamlFile, &metadata)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "testsnapname", metadata.Name)
|
||||
assert.Equal(t, "", metadata.Base)
|
||||
assert.Equal(t, "", metadata.License)
|
||||
assert.Equal(t, "mybin", metadata.Apps["mybin"].Command)
|
||||
assert.Equal(t, "mybin", metadata.Apps["testsnapname"].Command)
|
||||
|
@ -227,6 +227,7 @@ type Snapcraft struct {
|
||||
Name string `yaml:",omitempty"`
|
||||
Summary string `yaml:",omitempty"`
|
||||
Description string `yaml:",omitempty"`
|
||||
Base string `yaml:",omitempty"`
|
||||
License string `yaml:",omitempty"`
|
||||
Grade string `yaml:",omitempty"`
|
||||
Confinement string `yaml:",omitempty"`
|
||||
|
@ -73,6 +73,14 @@ snapcraft:
|
||||
# Your app's license, based on SPDX license expressions: https://spdx.org/licenses
|
||||
# Default is empty.
|
||||
license: MIT
|
||||
|
||||
# A snap of type base to be used as the execution environment for this snap.
|
||||
# Valid values are:
|
||||
# * bare - Empty base snap;
|
||||
# * core - Ubuntu Core 16;
|
||||
# * core18 - Ubuntu Core 18.
|
||||
# Default is empty.
|
||||
base: core18
|
||||
|
||||
# Each binary built by GoReleaser is an app inside the snap. In this section
|
||||
# you can declare extra details for those binaries. It is optional.
|
||||
|
Loading…
Reference in New Issue
Block a user