github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/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      # Wether 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      # A guardrail to prevent you from releasing a snap to all your users before
    64      # it is ready.
    65      # `devel` will let you release only to the `edge` and `beta` channels in the
    66      # store. `stable` will let you release also to the `candidate` and `stable`
    67      # channels. More info about channels here:
    68      # https://snapcraft.io/docs/reference/channels
    69      grade: stable
    70  
    71      # Snaps can be setup to follow three different confinement policies:
    72      # `strict`, `devmode` and `classic`. A strict confinement where the snap
    73      # can only read and write in its own namespace is recommended. Extra
    74      # permissions for strict snaps can be declared as `plugs` for the app, which
    75      # are explained later. More info about confinement here:
    76      # https://snapcraft.io/docs/reference/confinement
    77      confinement: strict
    78  
    79      # Your app's license, based on SPDX license expressions: https://spdx.org/licenses
    80      # Default is empty.
    81      license: MIT
    82  
    83      # A snap of type base to be used as the execution environment for this snap.
    84      # Valid values are:
    85      # * bare - Empty base snap;
    86      # * core - Ubuntu Core 16;
    87      # * core18 - Ubuntu Core 18.
    88      # Default is empty.
    89      base: core18
    90  
    91      # Add extra files on the resulting snap. Useful for including wrapper
    92      # scripts or other useful static files. Source filenames are relative to the
    93      # project directory. Destination filenames are relative to the snap prime
    94      # directory.
    95      # Default is empty.
    96      extra_files:
    97        - source: drumroll.wrapper
    98          destination: bin/drumroll.wrapper
    99          mode: 0755
   100  
   101      # Each binary built by GoReleaser is an app inside the snap. In this section
   102      # you can declare extra details for those binaries. It is optional.
   103      apps:
   104  
   105        # The name of the app must be the same name as the binary built or the snapcraft name.
   106        drumroll:
   107  
   108          # If your app requires extra permissions to work outside of its default
   109          # confined space, declare them here.
   110          # You can read the documentation about the available plugs and the
   111          # things they allow:
   112          # https://snapcraft.io/docs/reference/interfaces.
   113          plugs: ["home", "network", "personal-files"]
   114  
   115          # If you want your app to be autostarted and to always run in the
   116          # background, you can make it a simple daemon.
   117          daemon: simple
   118  
   119          # If you any to pass args to your binary, you can add them with the
   120          # args option.
   121          args: --foo
   122  
   123          # Bash completion snippet. More information about completion here:
   124          # https://docs.snapcraft.io/tab-completion-for-snaps.
   125          completer: drumroll-completion.bash
   126  
   127          # You can override the command name.
   128          # Defaults is the app name.
   129          command: bin/drumroll.wrapper
   130  
   131          # Restart condition of the snap.
   132          # Defaults to empty.
   133          # https://snapcraft.io/docs/snapcraft-yaml-reference
   134          restart_condition: "always"
   135  
   136      # Allows plugs to be configured. Plugs like system-files and personal-files
   137      # require this.
   138      # Default is empty.
   139      plugs:
   140        personal-files:
   141          read:
   142          - $HOME/.foo
   143          write:
   144          - $HOME/.foo
   145          - $HOME/.foobar
   146  ```
   147  
   148  !!! tip
   149      Learn more about the [name template engine](/customization/templates/).
   150  
   151  !!! note
   152      GoReleaser will not install `snapcraft` nor any of its dependencies for you.