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
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
```yaml
|
2021-12-23 01:52:01 +01:00
|
|
|
# .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).
|
|
|
|
#
|
2021-08-21 15:59:15 +02:00
|
|
|
# Default is `{{ .Version }}-SNAPSHOT-{{.ShortCommit}}`.
|
2023-04-02 17:16:21 -03:00
|
|
|
# Templates: allowed
|
2021-08-21 15:59:15 +02:00
|
|
|
name_template: '{{ incpatch .Version }}-devel'
|
2017-09-10 17:07:28 -03:00
|
|
|
```
|
2018-07-08 23:57:46 -07:00
|
|
|
|
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
|
|
|
|
2020-05-10 18:59:21 -03:00
|
|
|
!!! tip
|
2020-11-19 12:31:26 -08:00
|
|
|
Learn more about the [name template engine](/customization/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
|
|
|
|
only be generated into the `dist` folder.
|
2021-09-22 23:30:16 -03:00
|
|
|
|
|
|
|
!!! info "Maybe you are looking for something else?"
|
2021-09-24 20:18:52 -03:00
|
|
|
- If just want to build the binaries, and no packages at all, check the [`goreleaser build` command](/cmd/goreleaser_build/);
|
2022-05-07 01:28:22 -03:00
|
|
|
- If you actually want to create nightly builds, check out the [nightly documentation](/customization/nightlies/).
|