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