1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

41 lines
1.5 KiB
Markdown
Raw Normal View History

2021-10-30 09:50:23 -03:00
# Snapshots
2017-09-10 17:07:28 -03: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
GoReleaser supports this with the `--snapshot` flag
and also with the `snapshot` customization section:
2017-09-10 17:07:28 -03:00
```yaml
# .goreleaser.yaml
2017-09-10 17:07:28 -03:00
snapshot:
# Allows you to change the name of the generated snapshot
#
# Note that some pipes require this to be semantic version compliant (nfpm,
# for example).
#
# Default is `{{ .Version }}-SNAPSHOT-{{.ShortCommit}}`.
name_template: '{{ incpatch .Version }}-devel'
2017-09-10 17:07:28 -03:00
```
2018-07-08 23:57:46 -07:00
## How it works
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.
You can also check if its a snapshot build inside a template with:
```
{{ if .IsSnapshot }}something{{ else }}something else{{ end }}
```
!!! tip
Learn more about the [name template engine](/customization/templates/).
2018-12-13 12:07:54 -02:00
Note that the idea behind GoReleaser's snapshots is for local builds or to validate your build on the CI pipeline.
2022-04-20 00:34:24 +02:00
Artifacts won't be uploaded and will only be generated into the `dist` folder.
!!! info "Maybe you are looking for something else?"
- 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/nightlies/).