Skip to content

goreleaser

goreleaser release --clean on release tags. Attaches binaries to the Release that an upstream release-MR tool (e.g. releaser-pleaser) already created via release.mode: keep-existing, and — when configured in .goreleaser.yaml — uploads through GitLab's package registry, so no external storage is needed.

Defaults GOTOOLCHAIN=auto, so goreleaser honours go.mod's toolchain directive and downloads the required Go for the release build (the bundled dev-tools image's Go version may lag a project's pinned toolchain). Set gotoolchain: local to force the image's bundled Go instead.

Tag-gated by tag_pattern (RE2) — same shape as tofu-apply's and tofu-module-publish's tag_pattern. GIT_DEPTH: 0 is required — goreleaser walks the full commit history for changelog entries and snapshot version metadata.

Auto-retries transient failures (network blip, runner dropout, a notarization timestamp-server timeout) up to retry_max times — a single transient otherwise fails the entire release run and publishes zero assets; release.mode: keep-existing makes a retry idempotent.

Jobs

Job What it runs
goreleaser goreleaser $[[ inputs.args ]] (default release --clean), with retry: { max: $[[ inputs.retry_max ]], when: [script_failure, runner_system_failure, stuck_or_timeout_failure] }.

Inputs

Input Type Default Description
image string dev-tools:v0.1.2 Image to run goreleaser in. Override with goreleaser/goreleaser:vX.Y to use upstream's bundled Go instead.
stage string release GitLab CI stage.
tag_pattern string '^v[0-9]+\.[0-9]+\.[0-9]+$' RE2 pattern a tag must match to run.
gotoolchain string "auto" auto resolves go.mod's toolchain directive; local forces the image's bundled Go; or pin a specific version e.g. go1.26.4.
args string "release --clean" Arguments passed to goreleaser. Add --skip=publish for staging runs.
retry_max number 2 Automatic retries on a transient failure. GitLab caps this at 2; 0 disables.

Usage

include:
  - component: gitlab.com/phpboyscout/cicd/[email protected]

For a project with an embedded Svelte frontend built via go:generate (see Explanation: the Svelte frontend track), no extra wiring is needed — the go generate before-hook in .goreleaser.yaml builds the bundle. For a project using svelte-build instead, add:

goreleaser:
  needs:
    - job: svelte-build
      artifacts: true

See also