.PHONY: clean test release clean: go clean ./... test: go test -v ./... release: @# Ensure we're on main branch @if [ "$$(git branch --show-current)" != "main" ]; then \ echo "Error: must be on main branch to release"; \ exit 1; \ fi @# Ensure no uncommitted changes @if [ -n "$$(git status --porcelain)" ]; then \ echo "Error: uncommitted changes present on main branch"; \ exit 1; \ fi @# Push main to origin if needed @if [ -n "$$(git log origin/main..main 2>/dev/null)" ]; then \ echo "Pushing main to origin..."; \ git push origin main; \ fi @# Get new version from svu $(eval VERSION := $(shell svu next)) @echo "Creating release $(VERSION)..." @# Tag the current commit git tag -a $(VERSION) -m "Release $(VERSION)" @# Push the tag to origin git push origin $(VERSION) @echo "Released $(VERSION)"