A go template renderer based on Perl's Template Toolkit
1.PHONY: clean test release
2
3clean:
4 go clean ./...
5test:
6 go test -v ./...
7
8release:
9 @# Ensure we're on main branch
10 @if [ "$$(git branch --show-current)" != "main" ]; then \
11 echo "Error: must be on main branch to release"; \
12 exit 1; \
13 fi
14 @# Ensure no uncommitted changes
15 @if [ -n "$$(git status --porcelain)" ]; then \
16 echo "Error: uncommitted changes present on main branch"; \
17 exit 1; \
18 fi
19 @# Push main to origin if needed
20 @if [ -n "$$(git log origin/main..main 2>/dev/null)" ]; then \
21 echo "Pushing main to origin..."; \
22 git push origin main; \
23 fi
24 @# Get new version from svu
25 $(eval VERSION := $(shell svu next))
26 @echo "Creating release $(VERSION)..."
27 @# Tag the current commit
28 git tag -a $(VERSION) -m "Release $(VERSION)"
29 @# Push the tag to origin
30 git push origin $(VERSION)
31 @echo "Released $(VERSION)"