phoebus_os/scripts/publish.sh
Phoebus 875278b9a9 ci: make the Rust suite the only quality gate
Remove the Bash test suite and shellcheck from CI, the pre-commit hook, the
Makefile, agent-commit and publish. CI now runs cargo fmt, clippy and test.
2026-09-20 03:57:01 -07:00

39 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Publish the current commit to the configured public remote.
#
# Usage: scripts/publish.sh [REMOTE] [BRANCH]
# REMOTE defaults to origin
# BRANCH defaults to the current branch
#
# Refuses to push an unclean working tree or a failing test suite.
set -euo pipefail
root="$(git rev-parse --show-toplevel)"
cd "$root"
remote="${1:-origin}"
branch="${2:-$(git rev-parse --abbrev-ref HEAD)}"
if ! git remote get-url "$remote" >/dev/null 2>&1; then
echo "error: remote '$remote' is not configured." >&2
echo "add it once with: git remote add $remote <PUBLIC_REPO_URL>" >&2
exit 1
fi
if [[ -n "$(git status --porcelain)" ]]; then
echo "error: working tree is not clean; commit first (scripts/agent-commit.sh)." >&2
exit 1
fi
if command -v cargo >/dev/null 2>&1 && [[ -f installer-rs/Cargo.toml ]]; then
echo "running Rust test suite..."
(cd installer-rs && cargo test --workspace) || {
echo "cargo tests failed" >&2
exit 1
}
fi
echo "pushing $branch to $remote ($(git remote get-url "$remote"))"
git push "$remote" "$branch"
echo "published: $(git log -1 --oneline)"