2021-10-30 09:50:23 -03:00
|
|
|
# Release
|
2017-09-10 17:07:28 -03:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
GoReleaser can create a GitHub/GitLab/Gitea release with the current tag, upload
|
|
|
|
all the artifacts and generate the changelog based on the new commits since the
|
2018-02-18 20:37:59 -03:00
|
|
|
previous tag.
|
2017-09-10 17:07:28 -03:00
|
|
|
|
2021-07-10 17:11:37 +00:00
|
|
|
## GitHub
|
|
|
|
|
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
|
2021-12-23 01:52:01 +01:00
|
|
|
# .goreleaser.yaml
|
2017-09-10 17:07:28 -03:00
|
|
|
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.
|
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.
|
2023-04-02 17:16:21 -03:00
|
|
|
# Empty means all IDs.
|
|
|
|
#
|
|
|
|
# Default: []
|
2019-10-19 20:01:11 +01:00
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2017-09-10 17:07:28 -03:00
|
|
|
# If set to true, will not auto-publish the release.
|
2022-08-17 22:33:16 -03:00
|
|
|
# Available only for GitHub and Gitea.
|
2017-09-10 17:07:28 -03:00
|
|
|
draft: true
|
2017-10-05 15:47:29 +02:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
# Whether to remove existing draft releases with the same name before creating
|
|
|
|
# a new one.
|
2022-08-17 22:33:16 -03:00
|
|
|
# Only effective if `draft` is set to true.
|
|
|
|
# Available only for GitHub.
|
2022-09-11 16:54:51 -03:00
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Since: v1.11
|
2022-08-17 22:33:16 -03:00
|
|
|
replace_existing_draft: true
|
|
|
|
|
2022-08-22 21:31:28 -03:00
|
|
|
# Useful if you want to delay the creation of the tag in the remote.
|
|
|
|
# You can create the tag locally, but not push it, and run GoReleaser.
|
2022-09-17 00:13:09 -03:00
|
|
|
# It'll then set the `target_commitish` portion of the GitHub release to the
|
|
|
|
# value of this field.
|
2022-08-22 21:31:28 -03:00
|
|
|
# Only works on GitHub.
|
2022-09-11 16:54:51 -03:00
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: ''
|
|
|
|
# Since: v1.11
|
2023-05-17 23:22:36 +00:00
|
|
|
# Templates: allowed
|
2023-07-06 16:51:23 +00:00
|
|
|
target_commitish: "{{ .Commit }}"
|
2022-08-22 21:31:28 -03:00
|
|
|
|
2023-05-17 23:22:36 +00:00
|
|
|
# This allows to change which tag GitHub will create.
|
|
|
|
# Usually you'll use this together with `target_commitish`, or if you want to
|
|
|
|
# publish a binary from a monorepo into a public repository somewhere, without
|
|
|
|
# the tag prefix.
|
|
|
|
#
|
|
|
|
# Default: '{{ .PrefixedCurrentTag }}'
|
|
|
|
# Since: v1.19 (pro)
|
|
|
|
# Templates: allowed
|
2023-07-06 16:51:23 +00:00
|
|
|
tag: "{{ .CurrentTag }}"
|
2023-05-17 23:22:36 +00: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
|
|
|
|
2023-07-14 03:42:20 +02:00
|
|
|
# If set to false, will NOT mark the release as "latest".
|
|
|
|
# This prevents it from being shown at the top of the release list,
|
|
|
|
# and from being returned when calling https://api.github.com/repos/OWNER/REPO/releases/latest.
|
|
|
|
#
|
|
|
|
# Available only for GitHub.
|
|
|
|
#
|
|
|
|
# Default is true.
|
2023-07-14 03:42:20 +02:00
|
|
|
# Since: v1.20.
|
2023-07-14 03:42:20 +02:00
|
|
|
make_latest: true
|
|
|
|
|
2021-11-26 09:59:15 -03:00
|
|
|
# What to do with the release notes in case there the release already exists.
|
|
|
|
#
|
|
|
|
# Valid options are:
|
|
|
|
# - `keep-existing`: keep the existing notes
|
|
|
|
# - `append`: append the current release notes to the existing notes
|
|
|
|
# - `prepend`: prepend the current release notes to the existing notes
|
|
|
|
# - `replace`: replace existing notes
|
|
|
|
#
|
|
|
|
# Default is `keep-existing`.
|
|
|
|
mode: append
|
|
|
|
|
2023-04-02 17:16:21 -03:00
|
|
|
# Header for the release body.
|
|
|
|
#
|
|
|
|
# Templates: allowed
|
2021-05-30 21:53:40 -03:00
|
|
|
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!
|
|
|
|
|
2023-04-02 17:16:21 -03:00
|
|
|
# Footer for the release body.
|
|
|
|
#
|
|
|
|
# Templates: allowed
|
2021-05-30 21:53:40 -03:00
|
|
|
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.
|
2023-04-02 17:16:21 -03:00
|
|
|
#
|
|
|
|
# Default: '{{.Tag}}' ('{{.PrefixedTag}}' on Pro)
|
|
|
|
# Templates: allowed
|
2018-06-06 21:39:41 -03:00
|
|
|
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
|
2018-04-24 20:37:11 -07:00
|
|
|
|
2022-04-19 09:04:41 -03:00
|
|
|
# You can disable this pipe in order to not create the release on any SCM.
|
2022-09-17 00:13:09 -03:00
|
|
|
# Keep in mind that this might also break things that depend on the release
|
|
|
|
# URL, for instance, homebrew taps.
|
2022-04-19 09:04:41 -03:00
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Templates: allowed (since v1.15)
|
2018-04-24 20:37:11 -07:00
|
|
|
disable: true
|
2020-02-11 16:10:41 -03:00
|
|
|
|
2022-08-06 18:59:59 -03:00
|
|
|
# Set this to true if you want to disable just the artifact upload to the SCM.
|
2022-09-17 00:13:09 -03:00
|
|
|
# If this is true, GoReleaser will still create the release with the
|
|
|
|
# changelog, but won't upload anything to it.
|
2022-08-06 18:59:59 -03:00
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Since: v1.11
|
|
|
|
# Templates: allowed (since v1.15)
|
2022-08-06 18:59:59 -03:00
|
|
|
skip_upload: true
|
|
|
|
|
2020-02-11 16:10:41 -03:00
|
|
|
# You can add extra pre-existing files to the release.
|
2021-11-22 14:53:08 -03:00
|
|
|
# The filename on the release will be the last part of the path (base).
|
|
|
|
# If another file with the same name exists, the last one found will be used.
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Templates: allowed
|
2020-02-11 16:10:41 -03:00
|
|
|
extra_files:
|
|
|
|
- glob: ./path/to/file.txt
|
|
|
|
- glob: ./glob/**/to/**/file/**/*
|
|
|
|
- glob: ./glob/foo/to/bar/file/foobar/override_from_previous
|
2021-11-23 22:18:47 -03:00
|
|
|
- glob: ./single_file.txt
|
|
|
|
name_template: file.txt # note that this only works if glob matches 1 file only
|
2023-03-29 22:23:53 -03:00
|
|
|
|
|
|
|
# Additional templated extra files to add to the release.
|
|
|
|
# Those files will have their contents pass through the template engine,
|
|
|
|
# and its results will be added to the release.
|
|
|
|
#
|
|
|
|
# Since: v1.17 (pro)
|
2023-03-30 13:26:03 -03:00
|
|
|
# This feature is only available in GoReleaser Pro.
|
2023-04-02 17:16:21 -03:00
|
|
|
# Templates: allowed
|
2023-03-29 22:23:53 -03:00
|
|
|
templated_extra_files:
|
|
|
|
- src: LICENSE.tpl
|
|
|
|
dst: LICENSE.txt
|
2017-09-10 17:07:28 -03:00
|
|
|
```
|
|
|
|
|
2021-07-10 17:11:37 +00:00
|
|
|
!!! tip
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2022-08-17 22:33:16 -03:00
|
|
|
[Learn how to set up an API token, GitHub Enterprise, etc](/scm/github/).
|
2021-07-10 17:11:37 +00:00
|
|
|
|
|
|
|
## GitLab
|
|
|
|
|
2021-11-26 09:59:15 -03:00
|
|
|
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
|
2021-12-23 01:52:01 +01:00
|
|
|
# .goreleaser.yaml
|
2019-06-29 16:02:40 +02:00
|
|
|
release:
|
2022-09-17 00:13:09 -03:00
|
|
|
# Default is extracted from the origin remote URL or empty if its private
|
|
|
|
# hosted.
|
2021-07-26 11:57:11 -03:00
|
|
|
# You can also use Gitlab's internal project id by setting it in the name
|
|
|
|
# field and leaving the owner field empty.
|
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.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can change the name of the release.
|
2023-04-02 17:16:21 -03:00
|
|
|
#
|
|
|
|
# Default: '{{.Tag}}' ('{{.PrefixedTag}}' on Pro)
|
|
|
|
# Templates: allowed
|
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
|
|
|
disable: true
|
2020-02-11 16:10:41 -03:00
|
|
|
|
2021-11-26 09:59:15 -03:00
|
|
|
# What to do with the release notes in case there the release already exists.
|
|
|
|
#
|
|
|
|
# Valid options are:
|
|
|
|
# - `keep-existing`: keep the existing notes
|
|
|
|
# - `append`: append the current release notes to the existing notes
|
|
|
|
# - `prepend`: prepend the current release notes to the existing notes
|
|
|
|
# - `replace`: replace existing notes
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: 'keep-existing'
|
2021-11-26 09:59:15 -03:00
|
|
|
mode: append
|
|
|
|
|
2020-02-11 16:10:41 -03:00
|
|
|
# You can add extra pre-existing files to the release.
|
2021-11-23 22:18:47 -03:00
|
|
|
# The filename on the release will be the last part of the path (base).
|
|
|
|
# If another file with the same name exists, the last one found will be used.
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Templates: allowed
|
2020-02-11 16:10:41 -03:00
|
|
|
extra_files:
|
|
|
|
- glob: ./path/to/file.txt
|
|
|
|
- glob: ./glob/**/to/**/file/**/*
|
|
|
|
- glob: ./glob/foo/to/bar/file/foobar/override_from_previous
|
2021-11-23 22:18:47 -03:00
|
|
|
- glob: ./single_file.txt
|
|
|
|
name_template: file.txt # note that this only works if glob matches 1 file only
|
2019-06-29 16:02:40 +02:00
|
|
|
```
|
|
|
|
|
2021-07-10 17:11:37 +00:00
|
|
|
!!! tip
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2022-08-17 22:33:16 -03:00
|
|
|
[Learn how to set up an API token, self-hosted GitLab, etc](/scm/gitlab/).
|
2021-07-10 17:11:37 +00:00
|
|
|
|
2020-10-06 09:51:32 -03:00
|
|
|
!!! tip
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
If you use GitLab subgroups, you need to specify it in the `owner` field,
|
|
|
|
e.g. `mygroup/mysubgroup`.
|
2020-10-06 09:51:32 -03:00
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
!!! warning
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2021-07-10 17:11:37 +00:00
|
|
|
Only GitLab `v12.9+` is supported for releases.
|
|
|
|
|
|
|
|
## Gitea
|
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
|
2021-12-23 01:52:01 +01:00
|
|
|
# .goreleaser.yaml
|
2019-08-26 10:31:38 +03:00
|
|
|
release:
|
|
|
|
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
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
|
2020-09-06 11:14:45 -03:00
|
|
|
# You can change the name of the release.
|
2023-04-02 17:16:21 -03:00
|
|
|
#
|
|
|
|
# Default: '{{.Tag}}' ('{{.PrefixedTag}}' on Pro)
|
|
|
|
# Templates: allowed
|
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
|
|
|
disable: true
|
2020-02-11 16:10:41 -03:00
|
|
|
|
2021-11-26 09:59:15 -03:00
|
|
|
# What to do with the release notes in case there the release already exists.
|
|
|
|
#
|
|
|
|
# Valid options are:
|
|
|
|
# - `keep-existing`: keep the existing notes
|
|
|
|
# - `append`: append the current release notes to the existing notes
|
|
|
|
# - `prepend`: prepend the current release notes to the existing notes
|
|
|
|
# - `replace`: replace existing notes
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: 'keep-existing'
|
2021-11-26 09:59:15 -03:00
|
|
|
mode: append
|
|
|
|
|
2020-02-11 16:10:41 -03:00
|
|
|
# You can add extra pre-existing files to the release.
|
2021-11-23 22:18:47 -03:00
|
|
|
# The filename on the release will be the last part of the path (base).
|
|
|
|
# If another file with the same name exists, the last one found will be used.
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Templates: allowed
|
2020-02-11 16:10:41 -03:00
|
|
|
extra_files:
|
|
|
|
- glob: ./path/to/file.txt
|
|
|
|
- glob: ./glob/**/to/**/file/**/*
|
|
|
|
- glob: ./glob/foo/to/bar/file/foobar/override_from_previous
|
2021-11-23 22:18:47 -03:00
|
|
|
- glob: ./single_file.txt
|
|
|
|
name_template: file.txt # note that this only works if glob matches 1 file only
|
2019-08-26 10:31:38 +03:00
|
|
|
```
|
|
|
|
|
2022-09-17 00:13:09 -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
|
|
|
|
```
|
|
|
|
|
2021-07-10 17:11:37 +00:00
|
|
|
!!! tip
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2022-08-17 22:33:16 -03:00
|
|
|
[Learn how to set up an API token](/scm/gitea/).
|
2021-07-10 17:11:37 +00:00
|
|
|
|
|
|
|
!!! tip
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2021-07-10 17:11:37 +00:00
|
|
|
Learn more about the [name template engine](/customization/templates/).
|
|
|
|
|
2020-05-10 19:47:55 -03:00
|
|
|
!!! warning
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2020-05-10 19:47:55 -03:00
|
|
|
Gitea versions earlier than 1.9.2 do not support uploading `checksums.txt`
|
2022-09-17 00:13:09 -03:00
|
|
|
files because of a [bug](https://github.com/go-gitea/gitea/issues/7882),
|
2020-05-10 19:47:55 -03:00
|
|
|
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
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
`draft` and `prerelease` are only supported by GitHub and Gitea.
|
2019-06-29 16:02:40 +02:00
|
|
|
|
2020-01-31 19:38:56 +01:00
|
|
|
### Define Previous Tag
|
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
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.
|
2020-01-31 19:38:56 +01:00
|
|
|
|
2022-10-14 00:33:32 -03:00
|
|
|
The [Nightly](/customization/nightlies) is automatically ignored, even if set
|
|
|
|
via the environment variables above.
|
|
|
|
|
2017-09-10 17:07:28 -03:00
|
|
|
## Custom release notes
|
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
You can specify a file containing your custom release notes, and pass it with
|
|
|
|
the `--release-notes=FILE` flag. GoReleaser will then skip its own release notes
|
|
|
|
generation, using the contents of your file instead. 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
|
2022-09-17 00:13:09 -03:00
|
|
|
[process substitution](https://en.wikipedia.org/wiki/Process_substitution). To
|
|
|
|
list all commits since the last tag, but skip ones starting with `Merge` or
|
2017-10-16 10:50:11 -02:00
|
|
|
`docs`, you could run this command:
|
2017-09-30 22:37:11 +02:00
|
|
|
|
2019-03-24 20:10:30 -03:00
|
|
|
```sh
|
2023-05-27 00:18:39 -03:00
|
|
|
goreleaser release --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
|
2023-07-06 16:51:23 +00:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
If you create the release before running GoReleaser, and the said release
|
|
|
|
has some text in its body, GoReleaser will not override it with its release
|
|
|
|
notes.
|