#!/usr/bin/env fish
# Orchestrator for the local cargo-matrix release pipeline. Invoked via
# `cargo rake release` (see the [target.release] entry in Rakefile.toml).
#
# Usage: create and push a vX.Y.Z (or vX.Y.Z-rcN) tag first, then run this
# from the repo root (or let Rakefile.toml run it for you):
#
# git tag v0.5.0 && git push origin v0.5.0
# cargo rake release
#
# -rc tags are a build-only dry run: every publish stage after
# dispatch-remote-builds.fish is skipped -- this still exercises the
# repomon Linux/macOS/Windows/audit legs in full (build + scp hand-back),
# unlike a plain "build locally only" dry run.
#
# Unlike GitHub Actions, this pipeline needs no `gh release create` step:
# binaries are copied straight to a self-hosted static download directory
# (see publish-static.fish) rather than attached to a release object.
source (path dirname (status --current-filename))/lib.fish
cd (rel_repo_root)
or rel_die "not inside the cargo-matrix git repo"
rel_resolve_tag
# Export so every stage script (each a separate `fish` process) inherits the
# same tag/version, rather than re-deriving it from HEAD.
set -gx RELEASE_TAG $RELEASE_TAG
set -gx RELEASE_PKGVER $RELEASE_PKGVER
rel_log "releasing $RELEASE_TAG (pkgver $RELEASE_PKGVER)"
set -l here (path dirname (status --current-filename))
fish $here/dispatch-remote-builds.fish
or rel_die "dispatch-remote-builds stage failed"
if rel_is_rc
rel_log "$RELEASE_TAG is a pre-release (-rc) tag -- build-only dry run complete (including the repomon Linux/macOS/Windows/audit legs); skipping publish stages"
else
for stage in publish-static publish-crates
fish $here/$stage.fish
or rel_die "$stage stage failed"
end
rel_log "release $RELEASE_TAG complete."
end