Tinfoil.Scoop (tinfoil v0.2.22)

Copy Markdown View Source

Render a Scoop manifest from release artifacts and push it to a bucket repo. The Windows-package-manager counterpart to Tinfoil.Homebrew, same shape: mix task at CI time, token or deploy-key auth, dry-run preview.

Scoop's manifest is a JSON document keyed by architecture rather than a Ruby DSL, so unlike Homebrew there is no user-facing .eex template shipped into the user's repo -- tinfoil owns the manifest layout end-to-end. If you need to customize beyond the schema, override the rendered file in a post-publish step or open an issue.

Requires the :windows_x86_64 target to be in your :tinfoil :targets list (or Scoop has nothing to point at).

Summary

Types

Known error atoms returned by publish/2.

Types

error()

@type error() ::
  :scoop_not_enabled
  | :missing_tag
  | :missing_scoop_bucket_token
  | :missing_windows_target
  | :malformed_sha_sidecar
  | {:missing_sha_sidecar, atom(), Path.t()}
  | {:git_failed, [String.t()], non_neg_integer(), String.t()}

Known error atoms returned by publish/2.

  • :scoop_not_enabled -- config has scoop.enabled: false
  • :missing_tag -- no tag and GITHUB_REF_NAME is unset
  • :missing_scoop_bucket_token -- auth: :token but the SCOOP_BUCKET_TOKEN env var is missing. (The token_secret config only renames the workflow secret; the task always reads SCOOP_BUCKET_TOKEN, which the generated workflow maps it to.)
  • :missing_windows_target -- windows_x86_64 isn't in :targets, so there's nothing to publish
  • {:missing_sha_sidecar, target, path} -- the sha sidecar for the windows archive wasn't found in input_dir
  • :malformed_sha_sidecar
  • {:git_failed, args, exit_status, output}

opts()

@type opts() :: [
  input_dir: Path.t(),
  tag: String.t() | nil,
  bucket_dir: Path.t() | nil,
  dry_run: boolean() | nil,
  git: module()
]

preview()

@type preview() :: %{
  dry_run: true,
  bucket: String.t(),
  auth: :token | :deploy_key,
  clone_url: String.t(),
  manifest_name: String.t(),
  manifest: String.t(),
  commit_message: String.t()
}

result()

@type result() ::
  %{pushed: boolean(), manifest_path: Path.t(), commit_sha: String.t() | nil}
  | %{pushed: false, skipped: :prerelease}

Functions

publish(config, opts \\ [])

@spec publish(Tinfoil.Config.t(), opts()) ::
  {:ok, result()} | {:ok, preview()} | {:error, error() | term()}