|
1 | 1 | include make-*.mk |
2 | | -.PHONY: help push build-docker bump-version |
| 2 | +.PHONY: help push build-docker bump-version test release |
3 | 3 |
|
4 | 4 | help: |
5 | 5 | @echo "Available commands:" |
6 | 6 | @echo " help - Show this help message" |
7 | 7 | @echo " build - Build all Go binaries for all platforms (in Docker, output to ./dist)" |
8 | 8 | @echo " push - Update files in gist (binaries from ./dist, install/uninstall scripts, etc.)" |
9 | 9 | @echo " push! - build + push" |
| 10 | + @echo " test - Run all tests" |
10 | 11 | @echo " bump-version - Update version in main.go and create git tag" |
11 | 12 | @echo " push-version - Push changes and tags to remote repository" |
| 13 | + @echo " release - Run tests, bump version, and push (Usage: make release v=x.y.z)" |
12 | 14 | @echo " show-versions - Display all git tags" |
13 | 15 | @echo " install - Install sitedog" |
14 | 16 | @echo " uninstall - Uninstall sitedog" |
@@ -52,6 +54,33 @@ push-version: |
52 | 54 | git push |
53 | 55 | git push --tags |
54 | 56 |
|
| 57 | +test: |
| 58 | + @echo "Running tests..." |
| 59 | + go test -v |
| 60 | + |
| 61 | +release: |
| 62 | + @if [ -z "$(v)" ]; then \ |
| 63 | + echo "Usage: make release v=x.y.z"; \ |
| 64 | + echo "Example: make release v=0.6.6"; \ |
| 65 | + exit 1; \ |
| 66 | + fi; \ |
| 67 | + echo "🧪 Running tests..."; \ |
| 68 | + if ! go test -v; then \ |
| 69 | + echo "❌ Tests failed! Release aborted."; \ |
| 70 | + exit 1; \ |
| 71 | + fi; \ |
| 72 | + echo "✅ Tests passed!"; \ |
| 73 | + echo "📝 Bumping version to $(v)..."; \ |
| 74 | + sed -i 's/Version[ ]*=[ ]*".*"/Version = "$(v)"/' main.go; \ |
| 75 | + go fmt main.go; \ |
| 76 | + echo "📦 Creating commit and tag..."; \ |
| 77 | + git add main.go; \ |
| 78 | + git commit -m "🚀 Release $(v)"; \ |
| 79 | + git tag $(v); \ |
| 80 | + echo "🚀 Pushing to repository..."; \ |
| 81 | + git push origin main --tags; \ |
| 82 | + echo "✨ Release $(v) completed successfully!" |
| 83 | + |
55 | 84 | show-versions: |
56 | 85 | @git tag -l |
57 | 86 |
|
|
0 commit comments