2021-10-30 09:50:23 -03:00
|
|
|
# Snapshots
|
2017-09-10 17:07:28 -03:00
|
|
|
|
2017-10-01 18:57:52 +02:00
|
|
|
Sometimes we want to generate a full build of our project,
|
|
|
|
but neither want to validate anything nor upload it to anywhere.
|
2018-12-13 12:07:54 -02:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
GoReleaser supports this with the `--snapshot` flag and with the `snapshot`
|
|
|
|
customization section:
|
2017-09-10 17:07:28 -03:00
|
|
|
|
2024-11-29 11:17:45 -03:00
|
|
|
```yaml title=".goreleaser.yaml"
|
2017-09-10 17:07:28 -03:00
|
|
|
snapshot:
|
|
|
|
# Allows you to change the name of the generated snapshot
|
2019-11-15 18:23:25 -03:00
|
|
|
#
|
|
|
|
# Note that some pipes require this to be semantic version compliant (nfpm,
|
|
|
|
# for example).
|
|
|
|
#
|
2024-06-19 11:44:22 -03:00
|
|
|
# Default: `{{ .Version }}-SNAPSHOT-{{.ShortCommit}}`.
|
|
|
|
# Templates: allowed.
|
2024-08-05 23:28:48 -03:00
|
|
|
version_template: "{{ incpatch .Version }}-devel"
|
2017-09-10 17:07:28 -03:00
|
|
|
```
|
2018-07-08 23:57:46 -07:00
|
|
|
|
2024-09-19 23:55:10 -03:00
|
|
|
!!! warning
|
|
|
|
|
|
|
|
Do not use the `{{.Tag}}` field in the `version_template`, as the version
|
|
|
|
should not have the leading `v`.
|
|
|
|
|
2020-03-16 11:40:17 -03:00
|
|
|
## How it works
|
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
When you run GoReleaser with `--snapshot`, it will set the `Version` template
|
|
|
|
variable to the evaluation of `snapshot.name_template`. This means that if you
|
|
|
|
use `{{ .Version }}` on your name templates, you'll get the snapshot version.
|
2020-03-16 11:40:17 -03:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
You can also check if it's a snapshot build inside a template with:
|
2021-09-22 23:30:16 -03:00
|
|
|
|
|
|
|
```
|
|
|
|
{{ if .IsSnapshot }}something{{ else }}something else{{ end }}
|
|
|
|
```
|
2020-03-16 11:40:17 -03:00
|
|
|
|
2024-07-17 10:56:36 -03:00
|
|
|
<!-- md:templates -->
|
2018-12-13 12:07:54 -02:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
Note that the idea behind GoReleaser's snapshots is for local builds or to
|
|
|
|
validate your build on the CI pipeline. Artifacts won't be uploaded and will
|
2024-04-01 10:01:56 -03:00
|
|
|
only be generated into the `dist` directory.
|
2021-09-22 23:30:16 -03:00
|
|
|
|
|
|
|
!!! info "Maybe you are looking for something else?"
|
2024-04-01 10:01:56 -03:00
|
|
|
|
2024-07-08 23:30:10 -03:00
|
|
|
- If just want to build the binaries, and no packages at all, check the [`goreleaser build` command](../cmd/goreleaser_build.md);
|
|
|
|
- If you actually want to create nightly builds, check out the [nightly documentation](nightlies.md).
|