feat: add release targets to Makefile
This commit is contained in:
53
Makefile
53
Makefile
@@ -49,6 +49,53 @@ deps:
|
||||
init: deps frontend
|
||||
@echo "Project initialized. Run 'make dev' to start development."
|
||||
|
||||
# Get version from git tag
|
||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
||||
|
||||
# Release - build and package
|
||||
release:
|
||||
@echo "Building release $(VERSION)..."
|
||||
wails build -clean
|
||||
@mkdir -p dist
|
||||
cd build/bin && zip -r "../../dist/Daily-Timer-$(VERSION)-macos-arm64.zip" "Daily Timer.app"
|
||||
@echo "Release package: dist/Daily-Timer-$(VERSION)-macos-arm64.zip"
|
||||
@ls -lh dist/*.zip
|
||||
|
||||
# Release for both architectures
|
||||
release-all:
|
||||
@echo "Building release $(VERSION) for all platforms..."
|
||||
@mkdir -p dist
|
||||
GOOS=darwin GOARCH=arm64 wails build -clean -o daily-timer-arm64
|
||||
cd build/bin && zip -r "../../dist/Daily-Timer-$(VERSION)-macos-arm64.zip" "Daily Timer.app"
|
||||
GOOS=darwin GOARCH=amd64 wails build -clean -o daily-timer-amd64
|
||||
cd build/bin && zip -r "../../dist/Daily-Timer-$(VERSION)-macos-amd64.zip" "Daily Timer.app"
|
||||
@echo "Release packages:"
|
||||
@ls -lh dist/*.zip
|
||||
|
||||
# Upload release to Gitea (requires GITEA_TOKEN env var)
|
||||
release-upload:
|
||||
@if [ -z "$(GITEA_TOKEN)" ]; then echo "Error: GITEA_TOKEN not set"; exit 1; fi
|
||||
@echo "Creating release $(VERSION) on Gitea..."
|
||||
@RELEASE_ID=$$(curl -s -X POST \
|
||||
-H "Authorization: token $(GITEA_TOKEN)" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://git.movida.biz/api/v1/repos/bell/daily-timer/releases" \
|
||||
-d '{"tag_name": "$(VERSION)", "name": "$(VERSION)", "body": "Release $(VERSION)"}' \
|
||||
| jq -r '.id'); \
|
||||
echo "Created release ID: $$RELEASE_ID"; \
|
||||
for file in dist/*.zip; do \
|
||||
filename=$$(basename "$$file"); \
|
||||
echo "Uploading $$filename..."; \
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $(GITEA_TOKEN)" \
|
||||
-F "attachment=@$$file" \
|
||||
"https://git.movida.biz/api/v1/repos/bell/daily-timer/releases/$$RELEASE_ID/assets?name=$$filename"; \
|
||||
done
|
||||
@echo "Done!"
|
||||
|
||||
# Full release cycle: build + upload
|
||||
release-publish: release release-upload
|
||||
|
||||
# Help
|
||||
help:
|
||||
@echo "Daily Timer - Makefile Commands"
|
||||
@@ -58,6 +105,12 @@ help:
|
||||
@echo " make build - Build production binary for macOS"
|
||||
@echo " make build-universal - Build universal binary (Intel + Apple Silicon)"
|
||||
@echo ""
|
||||
@echo "Release:"
|
||||
@echo " make release - Build and package for current arch"
|
||||
@echo " make release-all - Build for all macOS architectures"
|
||||
@echo " make release-upload - Upload dist/*.zip to Gitea (needs GITEA_TOKEN)"
|
||||
@echo " make release-publish - Full cycle: build + upload"
|
||||
@echo ""
|
||||
@echo "Setup:"
|
||||
@echo " make init - Initialize project (install all dependencies)"
|
||||
@echo " make deps - Install Go and frontend dependencies"
|
||||
|
||||
Reference in New Issue
Block a user