···11+.PHONY: clean test release
22+33+# Clean all build artifacts
44+clean:
55+ go clean ./...
66+77+# Run tests
88+test:
99+ go test -v ./...
1010+1111+# Create a new release
1212+# - Ensures main branch has no uncommitted changes
1313+# - Pushes main to origin if needed
1414+# - Tags with version from svu next
1515+# - Pushes tags to origin
1616+release:
1717+ @# Ensure we're on main branch
1818+ @if [ "$$(git branch --show-current)" != "main" ]; then \
1919+ echo "Error: must be on main branch to release"; \
2020+ exit 1; \
2121+ fi
2222+ @# Ensure no uncommitted changes
2323+ @if [ -n "$$(git status --porcelain)" ]; then \
2424+ echo "Error: uncommitted changes present on main branch"; \
2525+ exit 1; \
2626+ fi
2727+ @# Push main to origin if needed
2828+ @if [ -n "$$(git log origin/main..main 2>/dev/null)" ]; then \
2929+ echo "Pushing main to origin..."; \
3030+ git push origin main; \
3131+ fi
3232+ @# Get new version from svu
3333+ $(eval VERSION := $(shell svu next))
3434+ @echo "Creating release $(VERSION)..."
3535+ @# Tag the current commit
3636+ git tag -a $(VERSION) -m "Release $(VERSION)"
3737+ @# Push the tag to origin
3838+ git push origin $(VERSION)
3939+ @echo "Released $(VERSION)"