github.com/goreleaser/goreleaser@v1.25.1/www/docs/customization/snapcraft.md (about) 1 # Snapcraft Packages (snaps) 2 3 GoReleaser can also generate `snap` packages. 4 [Snaps](http://snapcraft.io/) are a new packaging format, that will let you 5 publish your project directly to the Ubuntu store. 6 From there it will be installable in all the 7 [supported Linux distros](https://snapcraft.io/docs/core/install), with 8 automatic and transactional updates. 9 10 !!! warning 11 12 Snapcraft packages can't be build inside a Docker container. 13 14 You can read more about it in the [snapcraft docs](https://snapcraft.io/docs/). 15 16 Available options: 17 18 ```yaml 19 # .goreleaser.yaml 20 snapcrafts: 21 - # 22 # ID of the snapcraft config, must be unique. 23 # 24 # Default: 'default' 25 id: foo 26 27 # Build IDs for the builds you want to create snapcraft packages for. 28 builds: 29 - foo 30 - bar 31 32 # You can change the name of the package. 33 # 34 # Default: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}' 35 # Templates: allowed 36 name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 37 38 # The name of the snap. This is optional. 39 # 40 # Default: ProjectName 41 name: drumroll 42 43 # The canonical title of the application, displayed in the software 44 # centre graphical frontends. 45 # 46 # Since: v1.19 47 title: Drum Roll 48 49 # Path to icon image that represents the snap in the snapcraft.io store 50 # pages and other graphical store fronts. 51 # 52 # Since: v1.19 53 icon: ./icon.png 54 55 # Whether to publish the snap to the snapcraft store. 56 # Remember you need to `snapcraft login` first. 57 publish: true 58 59 # Single-line elevator pitch for your amazing snap. 60 # 79 char long at most. 61 summary: Software to create fast and easy drum rolls. 62 63 # This the description of your snap. You have a paragraph or two to tell the 64 # most important story about your snap. Keep it under 100 words though, 65 # we live in tweetspace and your description wants to look good in the snap 66 # store. 67 description: This is the best drum roll application out there. Install it and awe! 68 69 # Disable this configuration. 70 # 71 # Templates: allowed (since v1.20) 72 disable: true 73 74 # Channels in store where snap will be pushed. 75 # 76 # More info about channels here: 77 # https://snapcraft.io/docs/reference/channels 78 # 79 # Default: 80 # grade is 'stable': ["edge", "beta", "candidate", "stable"] 81 # grade is 'devel': ["edge", "beta"] 82 # Templates: allowed (since v1.15) 83 channel_templates: 84 - edge 85 - beta 86 - candidate 87 - stable 88 - "{{ .Major }}.{{ .Minor }}/edge" 89 - "{{ .Major }}.{{ .Minor }}/beta" 90 - "{{ .Major }}.{{ .Minor }}/candidate" 91 - "{{ .Major }}.{{ .Minor }}/stable" 92 93 # A guardrail to prevent you from releasing a snap to all your users before 94 # it is ready. 95 # `devel` will let you release only to the `edge` and `beta` channels in the 96 # store. `stable` will let you release also to the `candidate` and `stable` 97 # channels. 98 grade: stable 99 100 # Snaps can be setup to follow three different confinement policies: 101 # `strict`, `devmode` and `classic`. A strict confinement where the snap 102 # can only read and write in its own namespace is recommended. Extra 103 # permissions for strict snaps can be declared as `plugs` for the app, which 104 # are explained later. More info about confinement here: 105 # https://snapcraft.io/docs/reference/confinement 106 confinement: strict 107 108 # Your app's license, based on SPDX license expressions: 109 # https://spdx.org/licenses 110 license: MIT 111 112 # A snap of type base to be used as the execution environment for this snap. 113 # Valid values are: 114 # * bare - Empty base snap; 115 # * core - Ubuntu Core 16; 116 # * core18 - Ubuntu Core 18. 117 base: core18 118 119 # A list of features that must be supported by the core in order for 120 # this snap to install. 121 # 122 # Since: v1.19 123 assumes: 124 - snapd2.38 125 126 # his top-level keyword to define a hook with a plug to access more 127 # privileges. 128 # 129 # Since: v1.19 130 hooks: 131 install: 132 - network 133 134 # Add extra files on the resulting snap. Useful for including wrapper 135 # scripts or other useful static files. Source filenames are relative to the 136 # project directory. Destination filenames are relative to the snap prime 137 # directory. 138 extra_files: 139 - source: drumroll.wrapper 140 destination: bin/drumroll.wrapper 141 mode: 0755 142 143 # Additional templated extra files to add to the package. 144 # Those files will have their contents pass through the template engine, 145 # and its results will be added to the package. 146 # 147 # This feature is only available in GoReleaser Pro. 148 # Since: v1.17 (pro) 149 # Templates: allowed 150 templated_extra_files: 151 - source: LICENSE.tpl 152 destination: LICENSE.txt 153 mode: 0644 154 155 # With layouts, you can make elements in $SNAP, $SNAP_DATA, $SNAP_COMMON 156 # accessible from locations such as /usr, /var and /etc. This helps when 157 # using pre-compiled binaries and libraries that expect to find files and 158 # directories outside of locations referenced by $SNAP or $SNAP_DATA. 159 # About snap environment variables: 160 # * HOME: set to SNAP_USER_DATA for all commands 161 # * SNAP: read-only install directory 162 # * SNAP_ARCH: the architecture of device (eg, amd64, arm64, armhf, i386, etc) 163 # * SNAP_DATA: writable area for a particular revision of the snap 164 # * SNAP_COMMON: writable area common across all revisions of the snap 165 # * SNAP_LIBRARY_PATH: additional directories which should be added to LD_LIBRARY_PATH 166 # * SNAP_NAME: snap name 167 # * SNAP_INSTANCE_NAME: snap instance name incl. instance key if one is set (snapd 2.36+) 168 # * SNAP_INSTANCE_KEY: instance key if any (snapd 2.36+) 169 # * SNAP_REVISION: store revision of the snap 170 # * SNAP_USER_DATA: per-user writable area for a particular revision of the snap 171 # * SNAP_USER_COMMON: per-user writable area common across all revisions of the snap 172 # * SNAP_VERSION: snap version (from snap.yaml) 173 # More info about layout here: 174 # https://snapcraft.io/docs/snap-layouts 175 layout: 176 # The path you want to access in sandbox. 177 /etc/drumroll: 178 # Which outside file or directory you want to map to sandbox. 179 # Valid keys are: 180 # * bind - Bind-mount a directory. 181 # * bind_file - Bind-mount a file. 182 # * symlink - Create a symbolic link. 183 # * type - Mount a private temporary in-memory filesystem. 184 bind: $SNAP_DATA/etc 185 186 # Each binary built by GoReleaser is an app inside the snap. In this section 187 # you can declare extra details for those binaries. It is optional. 188 # See: https://snapcraft.io/docs/snapcraft-app-and-service-metadata 189 apps: 190 # The name of the app must be the same name as the binary built or the snapcraft name. 191 drumroll: 192 # If you any to pass args to your binary, you can add them with the 193 # args option. 194 args: --foo 195 196 # The kind of wrapper to generate for the given command. 197 # 198 # Since: v1.6 199 adapter: none 200 201 # List of applications that are ordered to be started after the current 202 # one. 203 # 204 # Since: v1.6 205 after: ["postdrum"] 206 207 # Aliases for the app command. 208 # https://snapcraft.io/docs/commands-and-aliases#heading--aliases 209 # 210 # Since: v1.6 211 aliases: ["droll"] 212 213 # Defines the name of the .desktop file used to start an application 214 # with the desktop session. 215 # https://snapcraft.io/docs/snap-format#heading--autostart 216 # 217 # Since: v1.6 218 autostart: drumroll.desktop 219 220 # List of applications that are ordered to be started before the current 221 # one. 222 # 223 # Since: v1.6 224 before: ["predrum"] 225 226 # D-Bus name this service is reachable as. Mandatory if daemon=dbus. 227 # 228 # Since: v1.6 229 bus_name: drumbus 230 231 # A list of commands to be executed in order before the command of this 232 # app. 233 # 234 # Since: v1.6 235 command_chain: ["foo", "bar", "baz"] 236 237 # An identifier to a desktop-id within an external appstream file. 238 # https://snapcraft.io/docs/using-external-metadata 239 # 240 # Since: v1.6 241 common_id: "com.example.drumroll" 242 243 # Bash completion snippet. More information about completion here: 244 # https://snapcraft.io/docs/tab-completion. 245 completer: drumroll-completion.bash 246 247 # You can override the command name. 248 # 249 # Default: AppName 250 command: bin/drumroll.wrapper 251 252 # If you want your app to be autostarted and to always run in the 253 # background, you can make it a simple daemon. 254 daemon: simple 255 256 # Location of the .desktop file. 257 # 258 # Since: v1.6 259 desktop: usr/share/applications/drumroll.desktop 260 261 # A set of key-value pairs specifying environment variables. 262 # 263 # Since: v1.6 264 environment: 265 foo: bar 266 baz: quo 267 268 # A list of Snapcraft extensions this app depends on. 269 # https://snapcraft.io/docs/snapcraft-extensions 270 # 271 # Since: v1.6 272 extensions: ["gnome-3-38"] 273 274 # Defines whether a freshly installed daemon is started automatically, 275 # or whether startup control is deferred to the snap. 276 # Requires `daemon` to be set. 277 # 278 # Since: v1.6 279 install_mode: "disable" 280 281 # A set of key-value attributes passed through to snap.yaml without 282 # snapcraft validation. 283 # https://snapcraft.io/docs/using-in-development-features 284 # 285 # Since: v1.6 286 passthrough: 287 foo: bar 288 289 # If your app requires extra permissions to work outside of its default 290 # confined space, declare them here. 291 # You can read the documentation about the available plugs and the 292 # things they allow: 293 # https://snapcraft.io/docs/supported-interfaces. 294 plugs: ["home", "network", "personal-files"] 295 296 # Sets a command to run from inside the snap after a service stops. 297 # 298 # Since: v1.6 299 post_stop_command: foo 300 301 # Controls whether the daemon should be restarted during a snap refresh. 302 # 303 # Since: v1.6 304 refresh_mode: endure 305 306 # Command to use to ask the service to reload its configuration. 307 # Requires `daemon` to be set. 308 # 309 # Since: v1.6 310 reload_command: foo 311 312 # Restart condition of the snap. 313 # https://snapcraft.io/docs/snapcraft-yaml-reference 314 restart_condition: "always" 315 316 # List of slots for interfaces to connect to. 317 # 318 # Since: v1.6 319 slots: ["foo", "bar", "baz"] 320 321 # Maps a daemon’s sockets to services and activates them. 322 # Requires `plugs` to contain `network-bind`. 323 # 324 # Since: v1.6 325 sockets: 326 sock: 327 listen-stream: $SNAP_COMMON/socket 328 socket-group: socket-group 329 socket-mode: 416 330 331 # Time to wait for daemon to start. 332 # 333 # Since: v1.6 334 start_timeout: 42ms 335 336 # Command to use to stop the service. 337 # Requires `daemon` to be set. 338 # 339 # Since: v1.6 340 stop_command: foo 341 342 # Controls how the daemon should be stopped. 343 # Requires `daemon` to be set. 344 # 345 # Since: v1.6 346 stop_mode: sigterm 347 348 # Time to wait for daemon to stop. 349 # 350 # Since: v1.6 351 stop_timeout: 42ms 352 353 # Schedules when, or how often, to run a service or command. 354 # Requires `daemon` to be set. 355 # https://snapcraft.io/docs/services-and-daemons 356 # 357 # Since: v1.6 358 timer: "00:00-24:00/24" 359 360 # Declares the service watchdog timeout. 361 # Requires `plugs` to contain `daemon-notify`. 362 # 363 # Since: v1.6 364 watchdog_timeout: 42ms 365 366 # Allows plugs to be configured. Plugs like system-files and personal-files 367 # require this. 368 plugs: 369 personal-files: 370 read: 371 - $HOME/.foo 372 write: 373 - $HOME/.foo 374 - $HOME/.foobar 375 ``` 376 377 !!! tip 378 379 Learn more about the [name template engine](/customization/templates/). 380 381 !!! note 382 383 GoReleaser will not install `snapcraft` nor any of its dependencies for you.