You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	feat(snapcraft): support title, icon, assumes & hooks (#3930)
This PR adds support for a few missing snapcraft fields which were required for my project. Reference here: https://snapcraft.io/docs/snapcraft-yaml-reference
This commit is contained in:
		| @@ -37,16 +37,20 @@ var ErrNoSummary = errors.New("no summary provided for snapcraft") | ||||
| // Metadata to generate the snap package. | ||||
| type Metadata struct { | ||||
| 	Name          string | ||||
| 	Title         string | ||||
| 	Version       string | ||||
| 	Summary       string | ||||
| 	Description   string | ||||
| 	Icon          string | ||||
| 	Base          string `yaml:",omitempty"` | ||||
| 	License       string `yaml:",omitempty"` | ||||
| 	Grade         string `yaml:",omitempty"` | ||||
| 	Confinement   string `yaml:",omitempty"` | ||||
| 	Architectures []string | ||||
| 	Assumes       []string                  `yaml:",omitempty"` | ||||
| 	Layout        map[string]LayoutMetadata `yaml:",omitempty"` | ||||
| 	Apps          map[string]AppMetadata | ||||
| 	Hooks         map[string]interface{} `yaml:",omitempty"` | ||||
| 	Plugs         map[string]interface{} `yaml:",omitempty"` | ||||
| } | ||||
|  | ||||
| @@ -269,6 +273,14 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [ | ||||
| 		Apps:          map[string]AppMetadata{}, | ||||
| 	} | ||||
|  | ||||
| 	if snap.Title != "" { | ||||
| 		metadata.Title = snap.Title | ||||
| 	} | ||||
|  | ||||
| 	if snap.Icon != "" { | ||||
| 		metadata.Icon = snap.Icon | ||||
| 	} | ||||
|  | ||||
| 	if snap.Base != "" { | ||||
| 		metadata.Base = snap.Base | ||||
| 	} | ||||
| @@ -377,6 +389,8 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [ | ||||
| 		} | ||||
|  | ||||
| 		metadata.Apps[name] = appMetadata | ||||
| 		metadata.Assumes = snap.Assumes | ||||
| 		metadata.Hooks = snap.Hooks | ||||
| 		metadata.Plugs = snap.Plugs | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -868,15 +868,19 @@ type Snapcraft struct { | ||||
| 	ID               string                             `yaml:"id,omitempty" json:"id,omitempty"` | ||||
| 	Builds           []string                           `yaml:"builds,omitempty" json:"builds,omitempty"` | ||||
| 	Name             string                             `yaml:"name,omitempty" json:"name,omitempty"` | ||||
| 	Title            string                             `yaml:"title,omitempty" json:"title,omitempty"` | ||||
| 	Summary          string                             `yaml:"summary,omitempty" json:"summary,omitempty"` | ||||
| 	Description      string                             `yaml:"description,omitempty" json:"description,omitempty"` | ||||
| 	Icon             string                             `yaml:"icon,omitempty" json:"icon,omitempty"` | ||||
| 	Base             string                             `yaml:"base,omitempty" json:"base,omitempty"` | ||||
| 	License          string                             `yaml:"license,omitempty" json:"license,omitempty"` | ||||
| 	Grade            string                             `yaml:"grade,omitempty" json:"grade,omitempty"` | ||||
| 	ChannelTemplates []string                           `yaml:"channel_templates,omitempty" json:"channel_templates,omitempty"` | ||||
| 	Confinement      string                             `yaml:"confinement,omitempty" json:"confinement,omitempty"` | ||||
| 	Assumes          []string                           `yaml:"assumes,omitempty" json:"assumes,omitempty"` | ||||
| 	Layout           map[string]SnapcraftLayoutMetadata `yaml:"layout,omitempty" json:"layout,omitempty"` | ||||
| 	Apps             map[string]SnapcraftAppMetadata    `yaml:"apps,omitempty" json:"apps,omitempty"` | ||||
| 	Hooks            map[string]interface{}             `yaml:"hooks,omitempty" json:"hooks,omitempty"` | ||||
| 	Plugs            map[string]interface{}             `yaml:"plugs,omitempty" json:"plugs,omitempty"` | ||||
|  | ||||
| 	Files []SnapcraftExtraFiles `yaml:"extra_files,omitempty" json:"extra_files,omitempty"` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user