2017-09-10 17:07:28 -03:00
|
|
|
---
|
2018-02-18 20:37:59 -03:00
|
|
|
title: Release
|
2017-09-10 17:07:28 -03:00
|
|
|
---
|
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
GoReleaser can create a GitHub/GitLab/Gitea release with the current tag, upload all
|
2018-02-18 20:37:59 -03:00
|
|
|
the artifacts and generate the changelog based on the new commits since the
|
|
|
|
previous tag.
|
2017-09-10 17:07:28 -03: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 17:07:28 -03:00
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
```yaml
|
2017-09-10 17:07:28 -03:00
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Repo in which the release will be created.
|
2020-04-21 13:21:04 -03:00
|
|
|
# Default is extracted from the origin remote URL or empty if its private hosted.
|
2021-06-26 19:46:16 +00:00
|
|
|
# Valid options are either github, gitlab or gitea
|
|
|
|
#
|
|
|
|
# You can also use Gitlab's internal project id by setting it in the name
|
|
|
|
# field and leaving the owner field empty.
|
2017-09-10 17:07:28 -03:00
|
|
|
github:
|
|
|
|
owner: user
|
|
|
|
name: repo
|
|
|
|
|
2019-10-19 20:01:11 +01:00
|
|
|
# IDs of the archives to use.
|
|
|
|
# Defaults to all.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2017-09-10 17:07:28 -03: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 17:07:28 -03:00
|
|
|
draft: true
|
2017-10-05 15:47:29 +02:00
|
|
|
|
2021-04-21 13:43:59 -03:00
|
|
|
# If set, will create a release discussion in the category specified.
|
2021-06-23 12:46:24 +00:00
|
|
|
#
|
|
|
|
# Warning: do not use categories in the 'Announcement' format.
|
|
|
|
# Check https://github.com/goreleaser/goreleaser/issues/2304 for more info.
|
|
|
|
#
|
2021-04-21 13:43:59 -03:00
|
|
|
# Default is empty.
|
|
|
|
discussion_category_name: General
|
|
|
|
|
2018-11-29 19:42:14 +01:00
|
|
|
# If set to auto, will mark the release as not ready for production
|
2019-01-10 16: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 19:42:14 +01:00
|
|
|
prerelease: auto
|
2017-10-07 04:31:14 -05:00
|
|
|
|
2021-07-03 16:58:24 +00:00
|
|
|
# Header template for the release body.
|
2021-05-30 21:53:40 -03:00
|
|
|
# Defaults to empty.
|
|
|
|
header: |
|
2021-07-03 16:58:24 +00:00
|
|
|
## Some title ({{ .Date }})
|
2021-05-30 21:53:40 -03:00
|
|
|
|
|
|
|
Welcome to this new release!
|
|
|
|
|
2021-07-03 16:58:24 +00:00
|
|
|
# Footer template for the release body.
|
2021-05-30 21:53:40 -03:00
|
|
|
# Defaults to empty.
|
|
|
|
footer: |
|
|
|
|
## Thanks!
|
|
|
|
|
2021-07-03 16:58:24 +00:00
|
|
|
Those were the changes on {{ .Tag }}!
|
2021-05-30 21:53:40 -03:00
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can change the name of the release.
|
2021-05-26 19:08:46 -03:00
|
|
|
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
|
2018-06-06 21:39:41 -03:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
2018-04-24 20:37:11 -07:00
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can disable this pipe in order to not upload any artifacts.
|
2018-04-24 20:37:11 -07:00
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
2020-02-11 16:10:41 -03: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 17:07:28 -03: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 18:59:21 -03:00
|
|
|
```yaml
|
2019-06-29 16:02:40 +02:00
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Same as for github
|
2020-09-06 11:14:45 -03: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 20:01:11 +01:00
|
|
|
# IDs of the archives to use.
|
|
|
|
# Defaults to all.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can change the name of the release.
|
2021-05-26 19:08:46 -03: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 11:14:45 -03: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 16:10:41 -03: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 09:51:32 -03:00
|
|
|
!!! tip
|
|
|
|
If you use GitLab subgroups, you need to specify it in the `owner` field, e.g. `mygroup/mysubgroup`.
|
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
!!! warning
|
2021-05-17 18:33:04 +01:00
|
|
|
Only GitLab `v12.9+` are supported for releases.
|
2020-05-10 18:59:21 -03:00
|
|
|
|
2019-08-26 10:31:38 +03:00
|
|
|
You can also configure the `release` section to upload to a [Gitea](https://gitea.io) instance:
|
2020-05-10 18:59:21 -03:00
|
|
|
|
|
|
|
```yaml
|
2019-08-26 10:31:38 +03:00
|
|
|
# .goreleaser.yml
|
|
|
|
release:
|
|
|
|
# Same as for github and gitlab
|
2020-09-06 11:14:45 -03:00
|
|
|
# Note: it can only be one: either github, gitlab or gitea
|
2019-08-26 10:31:38 +03:00
|
|
|
gitea:
|
|
|
|
owner: user
|
|
|
|
name: repo
|
|
|
|
|
2020-01-29 21:47:22 -03:00
|
|
|
# IDs of the artifacts to use.
|
2019-10-19 20:01:11 +01:00
|
|
|
# Defaults to all.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can change the name of the release.
|
2021-05-26 19:08:46 -03:00
|
|
|
# Default is `{{.Tag}}` on OSS and `{{.PrefixedTag}}` on Pro.
|
2019-08-26 10:31:38 +03:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can disable this pipe in order to not upload any artifacts.
|
2019-08-26 10:31:38 +03:00
|
|
|
# Defaults to false.
|
|
|
|
disable: true
|
2020-02-11 16:10:41 -03: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 10:31:38 +03: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 18:13:02 -03:00
|
|
|
|
2019-08-26 10:31:38 +03:00
|
|
|
```ini
|
|
|
|
[attachment]
|
|
|
|
ALLOWED_TYPES = application/gzip|application/x-gzip|application/x-gtar|application/x-tgz|application/x-compressed-tar|text/plain
|
|
|
|
```
|
|
|
|
|
2020-05-10 19:47:55 -03: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 10:31:38 +03:00
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
!!! warning
|
|
|
|
`draft` and `prerelease` are only supported by GitHub and Gitea.
|
2019-06-29 16:02:40 +02:00
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
!!! tip
|
2020-11-19 12:31:26 -08:00
|
|
|
Learn more about the [name template engine](/customization/templates/).
|
2018-07-08 23:57:46 -07:00
|
|
|
|
2017-10-16 10: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 11:14:45 -03: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 18:35:00 -02:00
|
|
|
skip: true
|
2021-04-01 08:50:29 -03:00
|
|
|
|
|
|
|
# Sorts the changelog by the commit's messages.
|
|
|
|
# Could either be asc, desc or empty
|
2018-09-11 12:34:59 -04:00
|
|
|
# Default is empty
|
|
|
|
sort: asc
|
2021-04-01 08:50:29 -03:00
|
|
|
|
2017-10-16 10:50:11 -02:00
|
|
|
filters:
|
2021-04-01 08:50:29 -03:00
|
|
|
|
|
|
|
# Commit messages matching the regexp listed here will be removed from
|
2017-10-16 10:50:11 -02:00
|
|
|
# the changelog
|
2017-12-20 11:32:21 +01:00
|
|
|
# Default is empty
|
2017-10-16 10:50:11 -02:00
|
|
|
exclude:
|
2017-10-17 23:45:19 -02:00
|
|
|
- '^docs:'
|
2017-10-16 10:50:11 -02:00
|
|
|
- typo
|
2017-10-17 23:45:19 -02:00
|
|
|
- (?i)foo
|
2017-10-16 10:50:11 -02:00
|
|
|
```
|
|
|
|
|
2020-01-31 19:38:56 +01: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 17:07:28 -03: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 17:07:28 -03: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 10: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-24 20:10:30 -03:00
|
|
|
```sh
|
2020-08-14 18:13:02 -03:00
|
|
|
goreleaser --release-notes <(some_changelog_generator)
|
2017-09-30 22:37:11 +02:00
|
|
|
```
|
2018-03-26 19:44:59 -03:00
|
|
|
|
|
|
|
Some changelog generators you can use:
|
|
|
|
|
2018-05-28 10:49:38 -03:00
|
|
|
- [buchanae/github-release-notes](https://github.com/buchanae/github-release-notes)
|
2020-12-28 11:38:37 -08:00
|
|
|
- [miniscruff/changie](https://github.com/miniscruff/changie)
|
2019-01-19 19:00:43 -02:00
|
|
|
|
2020-05-10 18:59:21 -03: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 11:14:45 -03:00
|
|
|
its release notes.
|