Dagger
Search

goreleaser

build base, config validation, a git-repo bootstrap, and the pure
tag/digest helpers shared by release pipelines. The full release
orchestration (publishing, signing, runtime images) stays in each project's
own CI module, which composes these primitives.

Installation

dagger install github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4

Entrypoint

Return Type
Goreleaser !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Project source directory. Ignore patterns belong in the consuming project's root dagger.json customizations, not here.
baseContainer -Base container to build on, typically the consumer's Go build base (e.g. the go toolchain's Base()), so GoReleaser reuses its caches and Go version. When nil, a plain golang:<goVersion> base is used.
goVersionString -Go version for the fallback base image. Only used when base is nil.
versionString -GoReleaser version. Defaults to the version pinned in this module.
imageString -goreleaser container image. Defaults to ghcr.io/goreleaser/goreleaser at the resolved version; override to pull from a mirror or air-gapped registry.
remoteUrlString -Git remote URL to configure as origin on the bootstrapped repo.
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
func (m *MyModule) Example() *dagger.Goreleaser  {
	return dag.
			Goreleaser()
}
@function
def example() -> dagger.Goreleaser:
	return (
		dag.goreleaser()
	)
@func()
example(): Goreleaser {
	return dag
		.goreleaser()
}

Types

Goreleaser 🔗

Goreleaser provides reusable GoReleaser CI primitives. Create instances with [New].

source() 🔗

Project source directory.

Return Type
Directory !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 source
func (m *MyModule) Example() *dagger.Directory  {
	return dag.
			Goreleaser().
			Source()
}
@function
def example() -> dagger.Directory:
	return (
		dag.goreleaser()
		.source()
	)
@func()
example(): Directory {
	return dag
		.goreleaser()
		.source()
}

base() 🔗

Base container to build on (typically the consumer’s Go build base).

Return Type
Container !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 base
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Goreleaser().
			Base()
}
@function
def example() -> dagger.Container:
	return (
		dag.goreleaser()
		.base()
	)
@func()
example(): Container {
	return dag
		.goreleaser()
		.base()
}

version() 🔗

GoReleaser version, used to compose the default image tag.

Return Type
String !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 version
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Goreleaser().
			Version(ctx)
}
@function
async def example() -> str:
	return await (
		dag.goreleaser()
		.version()
	)
@func()
async example(): Promise<string> {
	return dag
		.goreleaser()
		.version()
}

image() 🔗

goreleaser container image. Defaults to ghcr.io/goreleaser/goreleaser at Version; override to pull from a mirror or air-gapped registry.

Return Type
String !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 image
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Goreleaser().
			Image(ctx)
}
@function
async def example() -> str:
	return await (
		dag.goreleaser()
		.image()
	)
@func()
async example(): Promise<string> {
	return dag
		.goreleaser()
		.image()
}

remoteUrl() 🔗

Git remote URL configured on the bootstrapped repo, used by GoReleaser for changelog/version derivation and homebrew/nix repo resolution.

Return Type
String !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 remote-url
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Goreleaser().
			RemoteUrl(ctx)
}
@function
async def example() -> str:
	return await (
		dag.goreleaser()
		.remote_url()
	)
@func()
async example(): Promise<string> {
	return dag
		.goreleaser()
		.remoteUrl()
}

binary() 🔗

Binary returns the goreleaser executable, extracted from the configured image so it can be layered onto another container (e.g. a release base alongside cosign and syft).

Return Type
File !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 binary
func (m *MyModule) Example() *dagger.File  {
	return dag.
			Goreleaser().
			Binary()
}
@function
def example() -> dagger.File:
	return (
		dag.goreleaser()
		.binary()
	)
@func()
example(): File {
	return dag
		.goreleaser()
		.binary()
}

check() 🔗

Check validates the GoReleaser configuration (.goreleaser.yaml) syntax.

Return Type
Void !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 check
func (m *MyModule) Example(ctx context.Context)   {
	return dag.
			Goreleaser().
			Check(ctx)
}
@function
async def example() -> None:
	return await (
		dag.goreleaser()
		.check()
	)
@func()
async example(): Promise<void> {
	return dag
		.goreleaser()
		.check()
}

checkBase() 🔗

CheckBase returns a container with goreleaser, the project source mounted at /src, and a bootstrapped git repo – sufficient for goreleaser check.

Return Type
Container !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 check-base
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Goreleaser().
			CheckBase()
}
@function
def example() -> dagger.Container:
	return (
		dag.goreleaser()
		.check_base()
	)
@func()
example(): Container {
	return dag
		.goreleaser()
		.checkBase()
}

deduplicateDigests() 🔗

DeduplicateDigests returns unique image references from a list, keeping only the first occurrence of each sha256 digest.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
refs[String ! ] !-Image references (e.g. "registry/image:tag@sha256:hex").
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 deduplicate-digests --refs string1 --refs string2
func (m *MyModule) Example(ctx context.Context, refs []string) []string  {
	return dag.
			Goreleaser().
			DeduplicateDigests(ctx, refs)
}
@function
async def example(refs: List[str]) -> List[str]:
	return await (
		dag.goreleaser()
		.deduplicate_digests(refs)
	)
@func()
async example(refs: string[]): Promise<string[]> {
	return dag
		.goreleaser()
		.deduplicateDigests(refs)
}

ensureGitRepo() 🔗

EnsureGitRepo ensures the container has a valid git repository at its working directory with all files staged and committed. When running from a git worktree, the .git file references a host path absent in the container; in that case a full repository is initialized so tools like GoReleaser that depend on committed files, dirty-tree detection, and version derivation continue to work. A fixed committer date keeps the result cache-stable.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-Container to initialize.
remoteUrlString -Remote URL to add as origin. When empty, no remote is configured.
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 ensure-git-repo --ctr IMAGE:TAG
func (m *MyModule) Example(ctr *dagger.Container) *dagger.Container  {
	return dag.
			Goreleaser().
			EnsureGitRepo(ctr)
}
@function
def example(ctr: dagger.Container) -> dagger.Container:
	return (
		dag.goreleaser()
		.ensure_git_repo(ctr)
	)
@func()
example(ctr: Container): Container {
	return dag
		.goreleaser()
		.ensureGitRepo(ctr)
}

formatDigestChecksums() 🔗

FormatDigestChecksums converts publish output references to the checksums format expected by actions/attest-build-provenance. Each reference has the form “registry/image:tag@sha256:hex”; this emits “hex registry/image:tag” lines, deduplicating by digest.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
refs[String ! ] !-Image references (e.g. "registry/image:tag@sha256:hex").
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 format-digest-checksums --refs string1 --refs string2
func (m *MyModule) Example(ctx context.Context, refs []string) string  {
	return dag.
			Goreleaser().
			FormatDigestChecksums(ctx, refs)
}
@function
async def example(refs: List[str]) -> str:
	return await (
		dag.goreleaser()
		.format_digest_checksums(refs)
	)
@func()
async example(refs: string[]): Promise<string> {
	return dag
		.goreleaser()
		.formatDigestChecksums(refs)
}

goreleaserBase() 🔗

GoreleaserBase returns the base container with the goreleaser binary installed. This is the common base for config checks and release builds; callers mount source and bootstrap a git repo before running goreleaser. The binary is copied out of the official image rather than running that image directly, so it layers onto the caller’s Go build environment.

Return Type
Container !
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 goreleaser-base
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Goreleaser().
			GoreleaserBase()
}
@function
def example() -> dagger.Container:
	return (
		dag.goreleaser()
		.goreleaser_base()
	)
@func()
example(): Container {
	return dag
		.goreleaser()
		.goreleaserBase()
}

isPrerelease() 🔗

IsPrerelease reports whether the version tag contains a pre-release identifier (e.g. “v1.0.0-rc.1”).

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
tagString !-Version tag (e.g. "v1.2.3").
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 is-prerelease --tag string
func (m *MyModule) Example(ctx context.Context, tag string) bool  {
	return dag.
			Goreleaser().
			IsPrerelease(ctx, tag)
}
@function
async def example(tag: str) -> bool:
	return await (
		dag.goreleaser()
		.is_prerelease(tag)
	)
@func()
async example(tag: string): Promise<boolean> {
	return dag
		.goreleaser()
		.isPrerelease(tag)
}

registryHost() 🔗

RegistryHost extracts the host (with optional port) from a registry address. For example, “ghcr.io/macropower/eidetic” returns “ghcr.io”.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
registryString !-Registry address (e.g. "ghcr.io/macropower/eidetic").
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 registry-host --registry string
func (m *MyModule) Example(ctx context.Context, registry string) string  {
	return dag.
			Goreleaser().
			RegistryHost(ctx, registry)
}
@function
async def example(registry: str) -> str:
	return await (
		dag.goreleaser()
		.registry_host(registry)
	)
@func()
async example(registry: string): Promise<string> {
	return dag
		.goreleaser()
		.registryHost(registry)
}

verifyBinaryPlatform() 🔗

VerifyBinaryPlatform runs the file command on a built binary and asserts that its reported architecture matches the expected architecture for the target platform, catching cross-compilation mismatches. Returns an error when the architecture token is absent from the file output.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
binFile !-Built binary to inspect.
platformScalar !-Target platform (e.g. "linux/amd64").
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 verify-binary-platform --bin file:path
func (m *MyModule) Example(ctx context.Context, bin *dagger.File, platform )   {
	return dag.
			Goreleaser().
			VerifyBinaryPlatform(ctx, bin, platform)
}
@function
async def example(bin: dagger.File, platform: ) -> None:
	return await (
		dag.goreleaser()
		.verify_binary_platform(bin, platform)
	)
@func()
async example(bin: File, platform: ): Promise<void> {
	return dag
		.goreleaser()
		.verifyBinaryPlatform(bin, platform)
}

versionTags() 🔗

VersionTags returns the image tags derived from a version tag string. For example, “v1.2.3” yields [“latest”, “v1.2.3”, “v1”, “v1.2”]. Pre-release versions (e.g. “v1.0.0-rc.1”) yield only the exact tag.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
tagString !-Version tag (e.g. "v1.2.3").
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 version-tags --tag string
func (m *MyModule) Example(ctx context.Context, tag string) []string  {
	return dag.
			Goreleaser().
			VersionTags(ctx, tag)
}
@function
async def example(tag: str) -> List[str]:
	return await (
		dag.goreleaser()
		.version_tags(tag)
	)
@func()
async example(tag: string): Promise<string[]> {
	return dag
		.goreleaser()
		.versionTags(tag)
}

withGoreleaser() 🔗

WithGoreleaser installs the goreleaser binary at /usr/local/bin/goreleaser in the given container, for layering onto a caller’s own build environment.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-Container to install goreleaser into.
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
 with-goreleaser --ctr IMAGE:TAG
func (m *MyModule) Example(ctr *dagger.Container) *dagger.Container  {
	return dag.
			Goreleaser().
			WithGoreleaser(ctr)
}
@function
def example(ctr: dagger.Container) -> dagger.Container:
	return (
		dag.goreleaser()
		.with_goreleaser(ctr)
	)
@func()
example(ctr: Container): Container {
	return dag
		.goreleaser()
		.withGoreleaser(ctr)
}