# Run tests, clippy, and then publish
test-clippy-publish:
cargo test
cargo clippy -- -D warnings
cargo publish --manifest-path migs-macro/Cargo.toml
cargo publish --manifest-path Cargo.toml
# Run tests
test:
cargo test
# Run clippy check
clippy:
cargo clippy -- -D warnings
# Publish crates (macro first, then main)
publish:
cargo publish --manifest-path migs-macro/Cargo.toml
cargo publish --manifest-path Cargo.toml
# Bump patch version, commit, publish, and push
release:
#!/usr/bin/env bash
set -e
# Get current version from main crate
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "Current version: $CURRENT_VERSION"
# Parse version components
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
# Bump patch version
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "Bumping to version: $NEW_VERSION"
# Update version in both Cargo.toml files
sed -i "s/^version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" Cargo.toml
sed -i "s/^version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" migs-macro/Cargo.toml
# Update dependency version reference
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" Cargo.toml
# Commit version bump
git add -A
git commit -m "Bump version to $NEW_VERSION"
# Publish crates (with --allow-dirty to handle any generated files like Cargo.lock)
cargo publish --manifest-path migs-macro/Cargo.toml --allow-dirty
cargo publish --manifest-path Cargo.toml --allow-dirty
# Push to origin
git push origin main
echo "Released version $NEW_VERSION successfully!"