# distributing zigman

zigman ships as a single static binary, served from this repo as a tangled
[Git site](https://tangled.org) — no GitHub, no package registry, no CI.

## release flow

```sh
zig build release
```

cross-compiles every target (macos & linux, aarch64 & x86_64), gzips each into
`www/release/<arch>-<os>.tar.gz`, and copies `web/install.sh` + `web/index.html`
alongside. binaries are ReleaseSafe + stripped (~1 MB each, smaller gzipped).

> tarballs, not raw binaries: the static host treats an extensionless file under a
> sub-path as a directory (308 → trailing slash → 404), so each target ships as a
> `.tar.gz` that `install.sh` downloads and extracts.

then commit the result:

```sh
git add www && git commit -m "release: <version>"
git push
```

## one-time site setup

in the repo's **Settings → Sites**:

- **Branch**: the branch you pushed `www/` to (e.g. `main`)
- **Deploy directory**: `/www`
- **Site type**: Sub-path site → serves at `nate.tngl.io/zigman`
- **Save**

after the deploy lands, the install command works for anyone:

```sh
curl -fsSL https://nate.tngl.io/zigman/install.sh | sh
```

`install.sh` derives `<arch>-<os>` from `uname` and downloads the matching binary to
`$ZIGMAN_INSTALL` (default `~/.local/bin`).

## keeping binaries out of main history (optional)

committing ~4 MB of binaries to `main` each release bloats history. to avoid that,
push `www/` to a dedicated `site` branch instead and point Sites at it:

```sh
zig build release                       # produces ./www
git switch --orphan site
git rm -rf . >/dev/null 2>&1 || true
mv www/* . && rmdir www
git add . && git commit -m "release: <version>" && git push -u origin site
```

then set Branch = `site`, Deploy directory = `/`.

## adding a target

add an entry to the `targets` list in `build.zig`. the `dir` name must match
`"$(uname -m | arch-normalized)-$(uname -s | os-normalized)"` so `install.sh` finds it.
