github.com/ahmet2mir/goreleaser@v0.180.3-0.20210927151101-8e5ee5a9b8c5/www/docs/customization/snapcraft.md (about) 1 --- 2 title: Snapcraft 3 --- 4 5 GoReleaser can also generate `snap` packages. 6 [Snaps](http://snapcraft.io/) are a new packaging format, that will let you 7 publish your project directly to the Ubuntu store. 8 From there it will be installable in all the 9 [supported Linux distros](https://snapcraft.io/docs/core/install), with 10 automatic and transactional updates. 11 12 You can read more about it in the [snapcraft docs](https://snapcraft.io/docs/). 13 14 Available options: 15 16 ```yaml 17 # .goreleaser.yml 18 snapcrafts: 19 - 20 # ID of the snapcraft config, must be unique. 21 # Defaults to "default". 22 id: foo 23 24 # Build IDs for the builds you want to create snapcraft packages for. 25 # Defaults to all builds. 26 builds: 27 - foo 28 - bar 29 30 # You can change the name of the package. 31 # Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` 32 name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" 33 34 # Replacements for GOOS and GOARCH in the package name. 35 # Keys should be valid GOOSs or GOARCHs. 36 # Values are the respective replacements. 37 # Default is empty. 38 replacements: 39 amd64: 64-bit 40 386: 32-bit 41 darwin: macOS 42 linux: Tux 43 44 # The name of the snap. This is optional. 45 # Default is project name. 46 name: drumroll 47 48 # Whether to publish the snap to the snapcraft store. 49 # Remember you need to `snapcraft login` first. 50 # Defaults to false. 51 publish: true 52 53 # Single-line elevator pitch for your amazing snap. 54 # 79 char long at most. 55 summary: Software to create fast and easy drum rolls. 56 57 # This the description of your snap. You have a paragraph or two to tell the 58 # most important story about your snap. Keep it under 100 words though, 59 # we live in tweetspace and your description wants to look good in the snap 60 # store. 61 description: This is the best drum roll application out there. Install it and awe! 62 63 # Channels in store where snap will be pushed. 64 # Default depends on grade: 65 # * `stable` = ["edge", "beta", "candidate", "stable"] 66 # * `devel` = ["edge", "beta"] 67 # More info about channels here: 68 # https://snapcraft.io/docs/reference/channels 69 channel_templates: 70 - edge 71 - beta 72 - candidate 73 - stable 74 - {{ .Major }}.{{ .Minor }}/edge 75 - {{ .Major }}.{{ .Minor }}/beta 76 - {{ .Major }}.{{ .Minor }}/candidate 77 - {{ .Major }}.{{ .Minor }}/stable 78 79 # A guardrail to prevent you from releasing a snap to all your users before 80 # it is ready. 81 # `devel` will let you release only to the `edge` and `beta` channels in the 82 # store. `stable` will let you release also to the `candidate` and `stable` 83 # channels. 84 grade: stable 85 86 # Snaps can be setup to follow three different confinement policies: 87 # `strict`, `devmode` and `classic`. A strict confinement where the snap 88 # can only read and write in its own namespace is recommended. Extra 89 # permissions for strict snaps can be declared as `plugs` for the app, which 90 # are explained later. More info about confinement here: 91 # https://snapcraft.io/docs/reference/confinement 92 confinement: strict 93 94 # Your app's license, based on SPDX license expressions: https://spdx.org/licenses 95 # Default is empty. 96 license: MIT 97 98 # A snap of type base to be used as the execution environment for this snap. 99 # Valid values are: 100 # * bare - Empty base snap; 101 # * core - Ubuntu Core 16; 102 # * core18 - Ubuntu Core 18. 103 # Default is empty. 104 base: core18 105 106 # Add extra files on the resulting snap. Useful for including wrapper 107 # scripts or other useful static files. Source filenames are relative to the 108 # project directory. Destination filenames are relative to the snap prime 109 # directory. 110 # Default is empty. 111 extra_files: 112 - source: drumroll.wrapper 113 destination: bin/drumroll.wrapper 114 mode: 0755 115 116 # With layouts, you can make elements in $SNAP, $SNAP_DATA, $SNAP_COMMON 117 # accessible from locations such as /usr, /var and /etc. This helps when using 118 # pre-compiled binaries and libraries that expect to find files and 119 # directories outside of locations referenced by $SNAP or $SNAP_DATA. 120 # About snap environment variables: 121 # * HOME: set to SNAP_USER_DATA for all commands 122 # * SNAP: read-only install directory 123 # * SNAP_ARCH: the architecture of device (eg, amd64, arm64, armhf, i386, etc) 124 # * SNAP_DATA: writable area for a particular revision of the snap 125 # * SNAP_COMMON: writable area common across all revisions of the snap 126 # * SNAP_LIBRARY_PATH: additional directories which should be added to LD_LIBRARY_PATH 127 # * SNAP_NAME: snap name 128 # * SNAP_INSTANCE_NAME: snap instance name incl. instance key if one is set (snapd 2.36+) 129 # * SNAP_INSTANCE_KEY: instance key if any (snapd 2.36+) 130 # * SNAP_REVISION: store revision of the snap 131 # * SNAP_USER_DATA: per-user writable area for a particular revision of the snap 132 # * SNAP_USER_COMMON: per-user writable area common across all revisions of the snap 133 # * SNAP_VERSION: snap version (from snap.yaml) 134 # More info about layout here: 135 # https://snapcraft.io/docs/snap-layouts 136 # Default is empty. 137 layout: 138 # The path you want to access in sandbox. 139 /etc/drumroll: 140 141 # Which outside file or directory you want to map to sandbox. 142 # Valid keys are: 143 # * bind - Bind-mount a directory. 144 # * bind_file - Bind-mount a file. 145 # * symlink - Create a symbolic link. 146 # * type - Mount a private temporary in-memory filesystem. 147 bind: $SNAP_DATA/etc 148 149 # Each binary built by GoReleaser is an app inside the snap. In this section 150 # you can declare extra details for those binaries. It is optional. 151 apps: 152 153 # The name of the app must be the same name as the binary built or the snapcraft name. 154 drumroll: 155 156 # If your app requires extra permissions to work outside of its default 157 # confined space, declare them here. 158 # You can read the documentation about the available plugs and the 159 # things they allow: 160 # https://snapcraft.io/docs/reference/interfaces. 161 plugs: ["home", "network", "personal-files"] 162 163 # If you want your app to be autostarted and to always run in the 164 # background, you can make it a simple daemon. 165 daemon: simple 166 167 # If you any to pass args to your binary, you can add them with the 168 # args option. 169 args: --foo 170 171 # Bash completion snippet. More information about completion here: 172 # https://docs.snapcraft.io/tab-completion-for-snaps. 173 completer: drumroll-completion.bash 174 175 # You can override the command name. 176 # Defaults is the app name. 177 command: bin/drumroll.wrapper 178 179 # Restart condition of the snap. 180 # Defaults to empty. 181 # https://snapcraft.io/docs/snapcraft-yaml-reference 182 restart_condition: "always" 183 184 # Allows plugs to be configured. Plugs like system-files and personal-files 185 # require this. 186 # Default is empty. 187 plugs: 188 personal-files: 189 read: 190 - $HOME/.foo 191 write: 192 - $HOME/.foo 193 - $HOME/.foobar 194 ``` 195 196 !!! tip 197 Learn more about the [name template engine](/customization/templates/). 198 199 !!! note 200 GoReleaser will not install `snapcraft` nor any of its dependencies for you.