2017-09-10 22:07:28 +02:00
|
|
|
---
|
2018-02-19 01:37:59 +02:00
|
|
|
title: Release
|
2017-09-10 22:07:28 +02:00
|
|
|
---
|
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
GoReleaser can create a GitHub/GitLab/Gitea release with the current tag, upload all
|
2018-02-19 01:37:59 +02:00
|
|
|
the artifacts and generate the changelog based on the new commits since the
|
|
|
|
previous tag.
|
2017-09-10 22:07:28 +02:00
|
|
|
|
2019-06-29 16:02:40 +02:00
|
|
|
Let's see what can be customized in the `release` section for GitHub:
|
2017-09-10 22:07:28 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
```yaml
|
2017-09-10 22:07:28 +02:00
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Repo in which the release will be created.
|
2020-04-21 18:21:04 +02:00
|
|
|
# Default is extracted from the origin remote URL or empty if its private hosted.
|
2020-09-06 16:14:45 +02:00
|
|
|
# Note: it can only be one: either github, gitlab or gitea
|
2017-09-10 22:07:28 +02:00
|
|
|
github:
|
|
|
|
owner: user
|
|
|
|
name: repo
|
|
|
|
|
2019-10-19 21:01:11 +02:00
|
|
|
# IDs of the archives to use.
|
|
|
|
# Defaults to all.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2017-09-10 22:07:28 +02:00
|
|
|
# If set to true, will not auto-publish the release.
|
2017-10-01 18:57:52 +02:00
|
|
|
# Default is false.
|
2017-09-10 22:07:28 +02:00
|
|
|
draft: true
|
2017-10-05 15:47:29 +02:00
|
|
|
|
2021-04-21 18:43:59 +02:00
|
|
|
# If set, will create a release discussion in the category specified.
|
|
|
|
# Default is empty.
|
|
|
|
discussion_category_name: General
|
|
|
|
|
2018-11-29 20:42:14 +02:00
|
|
|
# If set to auto, will mark the release as not ready for production
|
2019-01-10 20:06:01 +02:00
|
|
|
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
|
2017-10-05 15:47:29 +02:00
|
|
|
# If set to true, will mark the release as not ready for production.
|
|
|
|
# Default is false.
|
2018-11-29 20:42:14 +02:00
|
|
|
prerelease: auto
|
2017-10-07 11:31:14 +02:00
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
# You can change the name of the release.
|
2021-05-27 00:08:46 +02:00
|
|
|
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
|
2018-06-07 02:39:41 +02:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
2018-04-25 05:37:11 +02:00
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
# You can disable this pipe in order to not upload any artifacts.
|
2018-04-25 05:37:11 +02:00
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
2020-02-11 21:10:41 +02:00
|
|
|
|
|
|
|
# You can add extra pre-existing files to the release.
|
|
|
|
# The filename on the release will be the last part of the path (base). If
|
|
|
|
# another file with the same name exists, the latest one found will be used.
|
|
|
|
# Defaults to empty.
|
|
|
|
extra_files:
|
|
|
|
- glob: ./path/to/file.txt
|
|
|
|
- glob: ./glob/**/to/**/file/**/*
|
|
|
|
- glob: ./glob/foo/to/bar/file/foobar/override_from_previous
|
2017-09-10 22:07:28 +02:00
|
|
|
```
|
|
|
|
|
2019-08-14 15:07:59 +02:00
|
|
|
Second, let's see what can be customized in the `release` section for GitLab.
|
2019-06-29 16:02:40 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
```yaml
|
2019-06-29 16:02:40 +02:00
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Same as for github
|
2020-09-06 16:14:45 +02:00
|
|
|
# Note: it can only be one: either github, gitlab or gitea
|
2019-06-29 16:02:40 +02:00
|
|
|
gitlab:
|
|
|
|
owner: user
|
|
|
|
name: repo
|
|
|
|
|
2019-10-19 21:01:11 +02:00
|
|
|
# IDs of the archives to use.
|
|
|
|
# Defaults to all.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
# You can change the name of the release.
|
2021-05-27 00:08:46 +02:00
|
|
|
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
|
2019-06-29 16:02:40 +02:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
# You can disable this pipe in order to not upload any artifacts.
|
2019-06-29 16:02:40 +02:00
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
2020-02-11 21:10:41 +02:00
|
|
|
|
|
|
|
# You can add extra pre-existing files to the release.
|
|
|
|
# The filename on the release will be the last part of the path (base). If
|
|
|
|
# another file with the same name exists, the latest one found will be used.
|
|
|
|
# Defaults to empty.
|
|
|
|
extra_files:
|
|
|
|
- glob: ./path/to/file.txt
|
|
|
|
- glob: ./glob/**/to/**/file/**/*
|
|
|
|
- glob: ./glob/foo/to/bar/file/foobar/override_from_previous
|
2019-06-29 16:02:40 +02:00
|
|
|
```
|
|
|
|
|
2020-10-06 14:51:32 +02:00
|
|
|
!!! tip
|
|
|
|
If you use GitLab subgroups, you need to specify it in the `owner` field, e.g. `mygroup/mysubgroup`.
|
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
!!! warning
|
2021-05-17 19:33:04 +02:00
|
|
|
Only GitLab `v12.9+` are supported for releases.
|
2020-05-10 23:59:21 +02:00
|
|
|
|
2019-08-26 09:31:38 +02:00
|
|
|
You can also configure the `release` section to upload to a [Gitea](https://gitea.io) instance:
|
2020-05-10 23:59:21 +02:00
|
|
|
|
|
|
|
```yaml
|
2019-08-26 09:31:38 +02:00
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Same as for github and gitlab
|
2020-09-06 16:14:45 +02:00
|
|
|
# Note: it can only be one: either github, gitlab or gitea
|
2019-08-26 09:31:38 +02:00
|
|
|
gitea:
|
|
|
|
owner: user
|
|
|
|
name: repo
|
|
|
|
|
2020-01-30 02:47:22 +02:00
|
|
|
# IDs of the artifacts to use.
|
2019-10-19 21:01:11 +02:00
|
|
|
# Defaults to all.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
# You can change the name of the release.
|
2021-05-27 00:08:46 +02:00
|
|
|
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
|
2019-08-26 09:31:38 +02:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
|
|
|
|
2020-09-06 16:14:45 +02:00
|
|
|
# You can disable this pipe in order to not upload any artifacts.
|
2019-08-26 09:31:38 +02:00
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
2020-02-11 21:10:41 +02:00
|
|
|
|
|
|
|
# You can add extra pre-existing files to the release.
|
|
|
|
# The filename on the release will be the last part of the path (base). If
|
|
|
|
# another file with the same name exists, the latest one found will be used.
|
|
|
|
# Defaults to empty.
|
|
|
|
extra_files:
|
|
|
|
- glob: ./path/to/file.txt
|
|
|
|
- glob: ./glob/**/to/**/file/**/*
|
|
|
|
- glob: ./glob/foo/to/bar/file/foobar/override_from_previous
|
2019-08-26 09:31:38 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
To enable uploading `tar.gz` and `checksums.txt` files you need to add the following to your Gitea config in `app.ini`:
|
2020-08-14 23:13:02 +02:00
|
|
|
|
2019-08-26 09:31:38 +02:00
|
|
|
```ini
|
|
|
|
[attachment]
|
|
|
|
ALLOWED_TYPES = application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|text/plain
|
|
|
|
```
|
|
|
|
|
2020-05-11 00:47:55 +02:00
|
|
|
!!! warning
|
|
|
|
Gitea versions earlier than 1.9.2 do not support uploading `checksums.txt`
|
|
|
|
files because of a [bug](https://github.com/go-gitea/gitea/issues/7882)
|
|
|
|
so you will have to enable all file types with `*/*`.
|
2019-08-26 09:31:38 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
!!! warning
|
|
|
|
`draft` and `prerelease` are only supported by GitHub and Gitea.
|
2019-06-29 16:02:40 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
!!! tip
|
2020-11-19 22:31:26 +02:00
|
|
|
Learn more about the [name template engine](/customization/templates/).
|
2018-07-09 08:57:46 +02:00
|
|
|
|
2017-10-16 14:50:11 +02:00
|
|
|
## Customize the changelog
|
|
|
|
|
|
|
|
You can customize how the changelog is generated using the
|
|
|
|
`changelog` section in the config file:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# .goreleaser.yml
|
|
|
|
changelog:
|
2020-09-06 16:14:45 +02:00
|
|
|
# Set it to true if you wish to skip the changelog generation.
|
|
|
|
# This may result in an empty release notes on GitHub/GitLab/Gitea.
|
2019-01-19 22:35:00 +02:00
|
|
|
skip: true
|
2021-04-01 13:50:29 +02:00
|
|
|
|
|
|
|
# Sorts the changelog by the commit's messages.
|
|
|
|
# Could either be asc, desc or empty
|
2018-09-11 18:34:59 +02:00
|
|
|
# Default is empty
|
|
|
|
sort: asc
|
2021-04-01 13:50:29 +02:00
|
|
|
|
2017-10-16 14:50:11 +02:00
|
|
|
filters:
|
2021-04-01 13:50:29 +02:00
|
|
|
|
|
|
|
# Commit messages matching the regexp listed here will be removed from
|
2017-10-16 14:50:11 +02:00
|
|
|
# the changelog
|
2017-12-20 12:32:21 +02:00
|
|
|
# Default is empty
|
2017-10-16 14:50:11 +02:00
|
|
|
exclude:
|
2017-10-18 03:45:19 +02:00
|
|
|
- '^docs:'
|
2017-10-16 14:50:11 +02:00
|
|
|
- typo
|
2017-10-18 03:45:19 +02:00
|
|
|
- (?i)foo
|
2017-10-16 14:50:11 +02:00
|
|
|
```
|
|
|
|
|
2020-01-31 20:38:56 +02:00
|
|
|
### Define Previous Tag
|
|
|
|
|
|
|
|
GoReleaser uses `git describe` to get the previous tag used for generating the Changelog.
|
|
|
|
You can set a different build tag using the environment variable `GORELEASER_PREVIOUS_TAG`.
|
|
|
|
This is useful in scenarios where two tags point to the same commit.
|
|
|
|
|
2017-09-10 22:07:28 +02:00
|
|
|
## Custom release notes
|
|
|
|
|
2017-10-01 18:57:52 +02:00
|
|
|
You can specify a file containing your custom release notes, and
|
|
|
|
pass it with the `--release-notes=FILE` flag.
|
2017-09-10 22:07:28 +02:00
|
|
|
GoReleaser will then skip its own release notes generation,
|
|
|
|
using the contents of your file instead.
|
2017-10-01 18:57:52 +02:00
|
|
|
You can use Markdown to format the contents of your file.
|
2017-09-30 22:37:11 +02:00
|
|
|
|
2017-10-16 14:50:11 +02:00
|
|
|
On Unix systems you can also generate the release notes in-line by using
|
|
|
|
[process substitution](https://en.wikipedia.org/wiki/Process_substitution).
|
|
|
|
To list all commits since the last tag, but skip ones starting with `Merge` or
|
|
|
|
`docs`, you could run this command:
|
2017-09-30 22:37:11 +02:00
|
|
|
|
2019-03-25 01:10:30 +02:00
|
|
|
```sh
|
2020-08-14 23:13:02 +02:00
|
|
|
goreleaser --release-notes <(some_changelog_generator)
|
2017-09-30 22:37:11 +02:00
|
|
|
```
|
2018-03-27 00:44:59 +02:00
|
|
|
|
|
|
|
Some changelog generators you can use:
|
|
|
|
|
2018-05-28 15:49:38 +02:00
|
|
|
- [buchanae/github-release-notes](https://github.com/buchanae/github-release-notes)
|
2020-12-28 21:38:37 +02:00
|
|
|
- [miniscruff/changie](https://github.com/miniscruff/changie)
|
2019-01-19 23:00:43 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
!!! info
|
|
|
|
If you create the release before running GoReleaser, and the
|
|
|
|
said release has some text in its body, GoReleaser will not override it with
|
2020-09-06 16:14:45 +02:00
|
|
|
its release notes.
|