1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/www/docs/customization/snapshots.md
Carlos Alexandro Becker c1965923b0
docs: improve wording/formatting in several places (#3384)
this just improves docs wording and formatting in several places.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-09-17 00:13:09 -03:00

43 lines
1.5 KiB
Markdown

# Snapshots
Sometimes we want to generate a full build of our project,
but neither want to validate anything nor upload it to anywhere.
GoReleaser supports this with the `--snapshot` flag and with the `snapshot`
customization section:
```yaml
# .goreleaser.yaml
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'
```
## 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 it's a snapshot build inside a template with:
```
{{ if .IsSnapshot }}something{{ else }}something else{{ end }}
```
!!! tip
Learn more about the [name template engine](/customization/templates/).
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
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/).