1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00
goreleaser/www/docs/customization/snapshots.md
Carlos Alexandro Becker d524d93086
docs: standarizing docs defaults, since, etc (#3898)
- [x] if the default is the zero-value for the field, do not specify
- [ ] TODO: add a "how to read this docs" section somewhere explaining
that
- [x] if the change was introduced in a v1.x.0, say only v1.x
- [x] drop trail ending `.` from Since, Default, etc
- [x] wording: always use `Default: ` instead of `Defaults to` and
others
- [x] add a note to templateable fields
- [x] default value of a field, if its a string, always between single
quotes `'`

---------

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-04-02 17:16:21 -03:00

1.5 KiB

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:

# .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}}`.
  # Templates: allowed
  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.

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; - If you actually want to create nightly builds, check out the nightly documentation.