2017-09-10 22:07:28 +02:00
|
|
|
---
|
|
|
|
title: Snapshots
|
|
|
|
---
|
|
|
|
|
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 16:07:54 +02:00
|
|
|
|
2017-10-01 18:57:52 +02:00
|
|
|
GoReleaser supports this with the `--snapshot` flag
|
|
|
|
and also with the `snapshot` customization section:
|
2017-09-10 22:07:28 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
```yaml
|
2017-09-10 22:07:28 +02:00
|
|
|
# .goreleaser.yml
|
|
|
|
snapshot:
|
|
|
|
# Allows you to change the name of the generated snapshot
|
2019-11-15 23:23:25 +02:00
|
|
|
#
|
|
|
|
# Note that some pipes require this to be semantic version compliant (nfpm,
|
|
|
|
# for example).
|
|
|
|
#
|
2021-08-21 15:59:15 +02:00
|
|
|
# Default is `{{ .Version }}-SNAPSHOT-{{.ShortCommit}}`.
|
|
|
|
name_template: '{{ incpatch .Version }}-devel'
|
2017-09-10 22:07:28 +02:00
|
|
|
```
|
2018-07-09 08:57:46 +02:00
|
|
|
|
2020-03-16 16:40:17 +02:00
|
|
|
## How it works
|
|
|
|
|
2021-09-23 04:30:16 +02: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 16:40:17 +02:00
|
|
|
|
2021-09-23 04:30:16 +02:00
|
|
|
You can also check if its a snapshot build inside a template with:
|
|
|
|
|
|
|
|
```
|
|
|
|
{{ if .IsSnapshot }}something{{ else }}something else{{ end }}
|
|
|
|
```
|
2020-03-16 16:40:17 +02:00
|
|
|
|
2020-05-10 23:59:21 +02:00
|
|
|
!!! tip
|
2020-11-19 22:31:26 +02:00
|
|
|
Learn more about the [name template engine](/customization/templates/).
|
2018-12-13 16:07:54 +02:00
|
|
|
|
2021-09-23 04:30:16 +02:00
|
|
|
Note that the idea behind GoReleaser's snapshots is for local builds or to validate your build on the CI pipeline.
|
|
|
|
Artifacts wont't be uploaded and will only be generated into the `dist` folder.
|
|
|
|
|
|
|
|
!!! info "Maybe you are looking for something else?"
|
2021-09-25 01:18:52 +02:00
|
|
|
- If just want to build the binaries, and no packages at all, check the [`goreleaser build` command](/cmd/goreleaser_build/);
|
|
|
|
- If you actually want to create nightly builds, check out the [nightly documentation](/customization/nightly/).
|