chore(ci): add GitHub Actions workflow for release process
* Implement test and release jobs for versioned tags * Build binaries for multiple OS/architecture targets * Create release and upload assets to GitHub * Add release-version target in Makefile for version bumping
This commit is contained in:
14
Makefile
14
Makefile
@@ -4,7 +4,7 @@ CONFIG_DIR := /etc/unitdore
|
||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
||||
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
|
||||
|
||||
.PHONY: all build install uninstall test lint clean
|
||||
.PHONY: all build install uninstall test lint clean release-version
|
||||
|
||||
all: build
|
||||
|
||||
@@ -40,6 +40,18 @@ lint:
|
||||
clean:
|
||||
rm -f $(BINARY)
|
||||
|
||||
## release-version: bump patch version, tag, and push to trigger release workflow
|
||||
release-version:
|
||||
@CURRENT=$$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"); \
|
||||
MAJOR=$$(echo $$CURRENT | sed 's/v\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'); \
|
||||
MINOR=$$(echo $$CURRENT | sed 's/v\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'); \
|
||||
PATCH=$$(echo $$CURRENT | sed 's/v\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'); \
|
||||
NEXT="v$$MAJOR.$$MINOR.$$((PATCH + 1))"; \
|
||||
echo "Current: $$CURRENT → Next: $$NEXT"; \
|
||||
git tag -a "$$NEXT" -m "Release $$NEXT"; \
|
||||
git push origin "$$NEXT"; \
|
||||
echo "Pushed tag $$NEXT — release workflow triggered"
|
||||
|
||||
## help: show this help
|
||||
help:
|
||||
@grep -E '^## ' Makefile | sed 's/## / /'
|
||||
|
||||
Reference in New Issue
Block a user