github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/www/docs/customization/release.md (about)

     1  ---
     2  title: Release
     3  ---
     4  
     5  GoReleaser can create a GitHub/GitLab/Gitea release with the current tag, upload all
     6  the artifacts and generate the changelog based on the new commits since the
     7  previous tag.
     8  
     9  Let's see what can be customized in the `release` section for GitHub:
    10  
    11  ```yaml
    12  # .goreleaser.yml
    13  release:
    14    # Repo in which the release will be created.
    15    # Default is extracted from the origin remote URL or empty if its private hosted.
    16    # Note: it can only be one: either github, gitlab or gitea
    17    github:
    18      owner: user
    19      name: repo
    20  
    21    # IDs of the archives to use.
    22    # Defaults to all.
    23    ids:
    24      - foo
    25      - bar
    26  
    27    # If set to true, will not auto-publish the release.
    28    # Default is false.
    29    draft: true
    30  
    31    # If set to auto, will mark the release as not ready for production
    32    # in case there is an indicator for this in the tag e.g. v1.0.0-rc1
    33    # If set to true, will mark the release as not ready for production.
    34    # Default is false.
    35    prerelease: auto
    36  
    37    # You can change the name of the release.
    38    # Default is `{{.Tag}}`
    39    name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
    40  
    41    # You can disable this pipe in order to not upload any artifacts.
    42    # Defaults to false.
    43    disable: true
    44  
    45    # You can add extra pre-existing files to the release.
    46    # The filename on the release will be the last part of the path (base). If
    47    # another file with the same name exists, the latest one found will be used.
    48    # Defaults to empty.
    49    extra_files:
    50      - glob: ./path/to/file.txt
    51      - glob: ./glob/**/to/**/file/**/*
    52      - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
    53  ```
    54  
    55  Second, let's see what can be customized in the `release` section for GitLab.
    56  
    57  ```yaml
    58  # .goreleaser.yml
    59  release:
    60    # Same as for github
    61    # Note: it can only be one: either github, gitlab or gitea
    62    gitlab:
    63      owner: user
    64      name: repo
    65  
    66    # IDs of the archives to use.
    67    # Defaults to all.
    68    ids:
    69      - foo
    70      - bar
    71  
    72    # You can change the name of the release.
    73    # Default is `{{.Tag}}`
    74    name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
    75  
    76    # You can disable this pipe in order to not upload any artifacts.
    77    # Defaults to false.
    78    disable: true
    79  
    80    # You can add extra pre-existing files to the release.
    81    # The filename on the release will be the last part of the path (base). If
    82    # another file with the same name exists, the latest one found will be used.
    83    # Defaults to empty.
    84    extra_files:
    85      - glob: ./path/to/file.txt
    86      - glob: ./glob/**/to/**/file/**/*
    87      - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
    88  ```
    89  
    90  !!! tip
    91      If you use GitLab subgroups, you need to specify it in the `owner` field, e.g. `mygroup/mysubgroup`.
    92  
    93  !!! warning
    94      Only GitLab `v11.7+` are supported for releases.
    95  
    96  You can also configure the `release` section to upload to a [Gitea](https://gitea.io) instance:
    97  
    98  ```yaml
    99  # .goreleaser.yml
   100  release:
   101    # Same as for github and gitlab
   102    # Note: it can only be one: either github, gitlab or gitea
   103    gitea:
   104      owner: user
   105      name: repo
   106  
   107    # IDs of the artifacts to use.
   108    # Defaults to all.
   109    ids:
   110      - foo
   111      - bar
   112  
   113    # You can change the name of the release.
   114    # Default is `{{.Tag}}`
   115    name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
   116  
   117    # You can disable this pipe in order to not upload any artifacts.
   118    # Defaults to false.
   119    disable: true
   120  
   121    # You can add extra pre-existing files to the release.
   122    # The filename on the release will be the last part of the path (base). If
   123    # another file with the same name exists, the latest one found will be used.
   124    # Defaults to empty.
   125    extra_files:
   126      - glob: ./path/to/file.txt
   127      - glob: ./glob/**/to/**/file/**/*
   128      - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
   129  ```
   130  
   131  To enable uploading `tar.gz` and `checksums.txt` files you need to add the following to your Gitea config in `app.ini`:
   132  
   133  ```ini
   134  [attachment]
   135  ALLOWED_TYPES = application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|text/plain
   136  ```
   137  
   138  !!! warning
   139      Gitea versions earlier than 1.9.2 do not support uploading `checksums.txt`
   140      files because of a [bug](https://github.com/go-gitea/gitea/issues/7882)
   141      so you will have to enable all file types with `*/*`.
   142  
   143  !!! warning
   144      `draft` and `prerelease` are only supported by GitHub and Gitea.
   145  
   146  !!! tip
   147      Learn more about the [name template engine](/customization/templates/).
   148  
   149  ## Customize the changelog
   150  
   151  You can customize how the changelog is generated using the
   152  `changelog` section in the config file:
   153  
   154  ```yaml
   155  # .goreleaser.yml
   156  changelog:
   157    # Set it to true if you wish to skip the changelog generation.
   158    # This may result in an empty release notes on GitHub/GitLab/Gitea.
   159    skip: true
   160    # could either be asc, desc or empty
   161    # Default is empty
   162    sort: asc
   163    filters:
   164      # commit messages matching the regexp listed here will be removed from
   165      # the changelog
   166      # Default is empty
   167      exclude:
   168        - '^docs:'
   169        - typo
   170        - (?i)foo
   171  ```
   172  
   173  ### Define Previous Tag
   174  
   175  GoReleaser uses `git describe` to get the previous tag used for generating the Changelog.
   176  You can set a different build tag using the environment variable `GORELEASER_PREVIOUS_TAG`.
   177  This is useful in scenarios where two tags point to the same commit.
   178  
   179  ## Custom release notes
   180  
   181  You can specify a file containing your custom release notes, and
   182  pass it with the `--release-notes=FILE` flag.
   183  GoReleaser will then skip its own release notes generation,
   184  using the contents of your file instead.
   185  You can use Markdown to format the contents of your file.
   186  
   187  On Unix systems you can also generate the release notes in-line by using
   188  [process substitution](https://en.wikipedia.org/wiki/Process_substitution).
   189  To list all commits since the last tag, but skip ones starting with `Merge` or
   190  `docs`, you could run this command:
   191  
   192  ```sh
   193  goreleaser --release-notes <(some_changelog_generator)
   194  ```
   195  
   196  Some changelog generators you can use:
   197  
   198  - [buchanae/github-release-notes](https://github.com/buchanae/github-release-notes)
   199  - [miniscruff/changie](https://github.com/miniscruff/changie)
   200  
   201  !!! info
   202      If you create the release before running GoReleaser, and the
   203      said release has some text in its body, GoReleaser will not override it with
   204      its release notes.