# Release workflow

Releases are built by [cargo-dist](https://opensource.axo.dev/cargo-dist/). Pushing a semver tag (e.g., `v0.1.0`) triggers `.github/workflows/release.yml`, which cross-compiles for all configured targets and publishes a GitHub Release with shell/PowerShell installers.

## Cutting a release

1. Bump `version` in `Cargo.toml`
2. Commit: `git commit -am "chore: bump version to X.Y.Z"`
3. Tag and push:

```bash
git tag vX.Y.Z
git push origin main vX.Y.Z
```

The Release workflow runs automatically on the tag push.

## Updating the release workflow

All release configuration lives in `Cargo.toml` under `[workspace.metadata.dist]`. After editing that section, regenerate the CI workflow:

```bash
dist generate
```

This overwrites `.github/workflows/release.yml`. Review the diff and commit.

**Do not hand-edit `release.yml`** -- the next `dist generate` will discard your changes.

## Preflight checks

`.github/workflows/main.yml` doubles as the preflight gate for releases. It has a `workflow_call` trigger in addition to `push`/`pull_request`, so the release pipeline reuses the same CI workflow via the `plan-jobs` key in `Cargo.toml`. This means `build-local-artifacts` will not start until CI passes.

Because `main.yml` is **not** auto-generated by `dist generate`, edit it directly when the pre-release checks need to change.

## Custom build setup

`dist generate` does **not** overwrite `.github/build-setup.yml`. This file is injected into each platform build job via the `github-build-setup` key in `Cargo.toml` and runs `gen-s2t-tables.py` to generate `s2t_data.rs` before compilation. Edit it directly when the pre-build steps need to change.

## Upgrading cargo-dist

1. Update `cargo-dist-version` in `Cargo.toml` to the new version
2. Regenerate: `dist generate`
3. Commit both `Cargo.toml` and the regenerated workflow
