goreleaser
build base, config validation, a git-repo bootstrap, and the puretag/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@9e8753a513d4e8800b3d3179de298283f3cb7cecEntrypoint
Return Type
Goreleaser !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Project source directory. Ignore patterns belong in the consuming project's root dagger.json customizations, not here. |
| base | Container | - | 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. |
| goVersion | String | - | Go version for the fallback base image. Only used when base is nil. |
| version | String | - | GoReleaser version. Defaults to the version pinned in this module. |
| remoteUrl | String | - | Git remote URL to configure as origin on the bootstrapped repo. |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec 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@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
sourcefunc (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@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
basefunc (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 (image tag for ghcr.io/goreleaser/goreleaser).
Return Type
String ! Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
versionfunc (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()
}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@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
remote-urlfunc (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()
}check() 🔗
Check validates the GoReleaser configuration (.goreleaser.yaml) syntax.
Return Type
Void ! Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
checkfunc (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@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
check-basefunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| refs | [String ! ] ! | - | Image references (e.g. "registry/image:tag@sha256:hex"). |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
deduplicate-digests --refs string1 --refs string2func (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| ctr | Container ! | - | Container to initialize. |
| remoteUrl | String | - | Remote URL to add as origin. When empty, no remote is configured. |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
ensure-git-repo --ctr IMAGE:TAGfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| refs | [String ! ] ! | - | Image references (e.g. "registry/image:tag@sha256:hex"). |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
format-digest-checksums --refs string1 --refs string2func (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@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
goreleaser-basefunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| tag | String ! | - | Version tag (e.g. "v1.2.3"). |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
is-prerelease --tag stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| registry | String ! | - | Registry address (e.g. "ghcr.io/macropower/eidetic"). |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
registry-host --registry stringfunc (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)
}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
| Name | Type | Default Value | Description |
|---|---|---|---|
| tag | String ! | - | Version tag (e.g. "v1.2.3"). |
Example
dagger -m github.com/MacroPower/x/toolchains/goreleaser@9e8753a513d4e8800b3d3179de298283f3cb7cec call \
version-tags --tag stringfunc (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)
}