#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
if [[ $# -lt 2 ]]; then
echo "Error: Missing arguments. Usage: ./shipit.sh <tag> <message>"
exit 1
fi
TAG="$1"
MESSAGE="$2"
echo "Checking for unstaged changes..."
if ! git diff --exit-code > /dev/null; then
echo "Error: You have unstaged changes. Please commit or stash them before running the tests."
exit 1
fi
echo "Updating dependencies..."
./scripts/updatedeps.sh
echo "Running all tests..."
./scripts/all-tests.sh
echo "Generating release notes..."
git diff "$(git rev-list --tags --max-count=1)"..HEAD -- . ":(exclude)vendor" | chatgpt -n -p ../prompts/write_release_notes.md for the 'how to update' section explain you can use brew upgrade chatgpt-cli or do a direct download of the binaries for your specific OS. The version we are releasing is "$TAG"
echo "Creating git tag..."
git tag -a "$TAG" -m "$MESSAGE"
git push origin --tags
echo "Creating binaries..."
./scripts/binaries.sh
echo "Release complete. Tag $TAG has been created, pushed, and binaries are ready."