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

40 lines
1.2 KiB
Markdown
Raw Normal View History

2017-09-10 22:07:28 +02:00
---
title: Snapshots
---
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
GoReleaser supports this with the `--snapshot` flag
and also with the `snapshot` customization section:
2017-09-10 22:07:28 +02:00
```yaml
2017-09-10 22:07:28 +02:00
# .goreleaser.yml
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 `{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}`.
name_template: 1.2.3-SNAPSHOT-{{.Commit}}
2017-09-10 22:07:28 +02:00
```
2018-07-09 08:57:46 +02: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.
!!! tip
Learn more about the [name template engine](/customization/templates/).
2018-12-13 16:07:54 +02:00
Note that the idea behind GoReleaser's snapshots if mostly for local builds
or to validate your build on the CI pipeline. Artifacts shouldn't be uploaded
anywhere, and will only be generated to the `dist` folder.
You can also use the `--snapshot-auto` flag to automatically switch to snapshot
if Git is currently in a dirty state.