Tinfoil.Build (tinfoil v0.2.22)

Copy Markdown View Source

Orchestrate a single-target Burrito build, archive, and checksum.

A single run/2 call is what one CI matrix entry does: resolve the tinfoil target to the user's Burrito name, run mix release with BURRITO_TARGET set, then locate the binary, tar.gz it, and write a sha256 sidecar.

This module is the heart of tinfoil's tool-in-the-loop story: the generated workflow calls mix tinfoil.build --target <atom> once per matrix entry instead of embedding the packaging logic in bash, so upgrading tinfoil upgrades the pipeline.

Summary

Functions

Build a single target end-to-end.

Check that the release tag matches the given version.

Types

opts()

@type opts() :: [
  target: Tinfoil.Target.target(),
  skip_release: boolean(),
  output_dir: Path.t()
]

result()

@type result() :: %{
  target: Tinfoil.Target.target(),
  burrito_name: atom(),
  binary: Path.t(),
  archive: Path.t(),
  sha256: String.t(),
  sha256_sidecar: Path.t()
}

Functions

run(config, opts)

@spec run(Tinfoil.Config.t(), opts()) :: result()

Build a single target end-to-end.

Steps:

  1. Look up the user's Burrito target name for the tinfoil target.
  2. Unless :skip_release is set, export BURRITO_TARGET and run mix release in the current project.
  3. Locate burrito_out/<app>_<burrito_name> and tar.gz it into the output directory with the configured archive basename.
  4. Write a .sha256 sidecar next to the archive.

Returns a map describing what was produced.

validate_tag_version(mix_version, opts \\ [])

@spec validate_tag_version(
  String.t(),
  keyword()
) :: :ok | {:skip, String.t()} | {:error, String.t()}

Check that the release tag matches the given version.

The tag comes from opts[:tag] if given, otherwise from the GITHUB_REF_NAME environment variable. Explicit beats env, matching how Tinfoil.Publish, Tinfoil.Homebrew, and Tinfoil.Scoop resolve the tag.

Returns:

  • :ok — no tag available, or the tag matches
  • {:skip, message} — the tag is not version-shaped, so there is nothing meaningful to compare. Callers should warn and continue.
  • {:error, message} — a real mismatch