Skip to content

Using GoReleaser templates

Ryan Parman edited this page Apr 8, 2024 · 1 revision

Universal configs

There are some GoReleaser templates that should be used pretty universally.

  • _dist.yml
  • _env.yml
  • _nightly.yml

Build and nfpm

Often, _build* and _nfpms* naming patterns will go together, based on what you're trying to do.

One and one

It is expected that you will have at least one binary for Intel and one binary for ARM.

Intel64 ARM64
Linux

When you have only these two binaries, you can use the non-suffixed files:

  • _builds.yml
  • _nfpms.yml

Tip

This is common with Go, but not necessarily Cgo.

Two and two

Some languages will link to the system's libc implementation, meaning that there will be separate binaries for Alpine Linux (musl) and most other linuxes (glibc).

Intel64 ARM64
Linux/glibc
Linux/musl

In this case, you'll want to use the files with glibc_musl in the name. Both are supported, but they have separate binaries.

  • _builds_glibc_musl.yml
  • _nfpms_glibc_musl.yml

Tip

This is common with Rust.

glibc-only

Intel64 ARM64
Linux/glibc
Linux/musl × ×
  • _builds_glibc.yml
  • _nfpms_glibc.yml

musl-only

Intel64 ARM64
Linux/glibc × ×
Linux/musl
  • _builds_musl.yml
  • _nfpms_musl.yml

Three-of-four

In some cases due to constraints (see Building Rust binaries for more information), you may only be able to build 3/4 of the matrix. Most often, ARM64 on musl is held back.

Intel64 ARM64
Linux/glibc
Linux/musl ×
  • _builds_glibc.yml
  • _builds_musl_amd64.yml
  • _nfpms_glibc.yml
  • _nfpms_musl_amd64.yml

This will define 3 distinct builds of the matrix.

Separate build for every OS version and CPU architecture

TBD