2017-09-10 22:07:28 +02:00
|
|
|
---
|
2018-02-19 01:37:59 +02:00
|
|
|
title: Release
|
2018-04-25 07:20:12 +02:00
|
|
|
series: customization
|
|
|
|
hideFromIndex: true
|
|
|
|
weight: 110
|
2017-09-10 22:07:28 +02:00
|
|
|
---
|
|
|
|
|
2019-06-29 16:02:40 +02:00
|
|
|
GoReleaser will create a GitHub/GitLab 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
|
|
|
|
|
|
|
```yml
|
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Repo in which the release will be created.
|
|
|
|
# Default is extracted from the origin remote URL.
|
2019-08-26 09:31:38 +02:00
|
|
|
# Note: it can only be one: either github or 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
|
|
|
|
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
|
|
|
|
2017-10-16 21:18:53 +02:00
|
|
|
# You can change the name of the GitHub release.
|
2019-01-10 20:06:01 +02:00
|
|
|
# Default is `{{.Tag}}`
|
2018-06-07 02:39:41 +02:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
2018-04-25 05:37:11 +02:00
|
|
|
|
|
|
|
# You can disable this pipe in order to not upload any artifacts to
|
|
|
|
# GitHub.
|
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
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.
|
|
|
|
**Note** that only GitLab `v11.7+` are supported for releases:
|
2019-06-29 16:02:40 +02:00
|
|
|
|
|
|
|
```yml
|
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Same as for github
|
2019-08-26 09:31:38 +02:00
|
|
|
# Note: it can only be one: either github or 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
|
|
|
|
|
2019-06-29 16:02:40 +02:00
|
|
|
# You can change the name of the GitLab release.
|
|
|
|
# Default is `{{.Tag}}`
|
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
|
|
|
|
|
|
|
# You can disable this pipe in order to not upload any artifacts to
|
|
|
|
# GitLab.
|
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
|
|
|
```
|
|
|
|
|
2019-08-26 09:31:38 +02:00
|
|
|
You can also configure the `release` section to upload to a [Gitea](https://gitea.io) instance:
|
|
|
|
```yml
|
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Same as for github and gitlab
|
|
|
|
# Note: it can only be one: either github or gitlab or gitea
|
|
|
|
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
|
|
|
|
|
2019-08-26 09:31:38 +02:00
|
|
|
# You can change the name of the Gitea release.
|
|
|
|
# Default is `{{.Tag}}`
|
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
|
|
|
|
|
|
|
# You can disable this pipe in order to not upload any artifacts to
|
|
|
|
# Gitea.
|
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
|
|
|
```
|
|
|
|
|
|
|
|
To enable uploading `tar.gz` and `checksums.txt` files you need to add the following to your Gitea config in `app.ini`:
|
|
|
|
```ini
|
|
|
|
[attachment]
|
|
|
|
ALLOWED_TYPES = application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|text/plain
|
|
|
|
```
|
|
|
|
|
|
|
|
> 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 `*/*`.
|
|
|
|
|
|
|
|
**Note**: `draft` and `prerelease` are only supported by GitHub and Gitea.
|
2019-06-29 16:02:40 +02:00
|
|
|
|
2018-07-09 08:57:46 +02:00
|
|
|
> Learn more about the [name template engine](/templates).
|
|
|
|
|
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:
|
2019-01-19 22:35:00 +02:00
|
|
|
# set it to true if you wish to skip the changelog generation
|
|
|
|
skip: true
|
2018-09-11 18:34:59 +02:00
|
|
|
# could either be asc, desc or empty
|
|
|
|
# Default is empty
|
|
|
|
sort: asc
|
2017-10-16 14:50:11 +02:00
|
|
|
filters:
|
2017-10-18 03:45:19 +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
|
2018-02-19 01:37:59 +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)
|
2019-01-19 23:00:43 +02:00
|
|
|
|
2019-03-25 01:10:30 +02:00
|
|
|
> **Important**: If you create the release before running GoReleaser, and the
|
|
|
|
> said release has some text in its body, GoReleaser will not override it with
|
|
|
|
> it's release notes.
|