Create release archives from built binaries.
Archive creation is bytes-in, bytes-out: given a binary path and an
archive basename, produce either a gzipped tarball (tar_gz/4,
used for the unix targets) or a zip file (zip/4, used for
Windows targets where users expect .zip/.exe), plus a .sha256
sidecar in shasum -a 256 format. The choice of format is driven
by the target spec's archive_ext and dispatched in Tinfoil.Build.
Uses Erlang's built-in :erl_tar, :zip, and :crypto — no
shelling out, no extra dependencies.
Summary
Functions
Combine per-archive .sha256 sidecars under input_dir into a
single checksums-sha256.txt file at Path.join(input_dir, name).
Compute the SHA256 of the file at path, write a <path>.sha256
sidecar in shasum -a 256 format (<hex> <filename>\n), and
return {hex_digest, sidecar_path}.
Create <output_dir>/<archive_basename>.tar.gz containing the file
at binary_path, renamed to to_string(app) inside the archive.
Create <output_dir>/<archive_basename>.zip containing the file at
binary_path, renamed to name_in_archive inside the archive.
Functions
Combine per-archive .sha256 sidecars under input_dir into a
single checksums-sha256.txt file at Path.join(input_dir, name).
Returns the path to the combined file.
Compute the SHA256 of the file at path, write a <path>.sha256
sidecar in shasum -a 256 format (<hex> <filename>\n), and
return {hex_digest, sidecar_path}.
Create <output_dir>/<archive_basename>.tar.gz containing the file
at binary_path, renamed to to_string(app) inside the archive.
The archive entry is written with mode 0755 so the extracted
binary is executable without the user needing a manual chmod +x.
This matters for anyone who downloads the tarball directly — the
installer script does its own chmod, but a plain tar -xzf extract
should produce something runnable.
Returns the path to the written archive.
Create <output_dir>/<archive_basename>.zip containing the file at
binary_path, renamed to name_in_archive inside the archive.
Used for Windows targets, where users expect .zip and the wrapped
binary already carries a .exe suffix (so name_in_archive should
include it). The zip format does not carry unix mode bits, so no
chmod dance is needed.
Returns the path to the written archive.