- Makefile: cross-compile to linux/{amd64,arm64}, darwin/{amd64,arm64},
windows/amd64 into dist/ with SHA256SUMS. Version is stamped via
-ldflags '-X main.version=...'.
- .gitea/workflows/release.yml: on tag push (v*) the workflow runs
`make dist`, creates a Gitea release for the tag and uploads every
artefact from dist/ via the Gitea API.
- main.go: `rb-search version` / --version prints the stamped version.
- README: new "Готовые бинари" section with curl/Invoke-WebRequest
install snippets and a checksum-verify hint.
This commit is contained in:
33
Makefile
Normal file
33
Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||
LDFLAGS := -s -w -X main.version=$(VERSION)
|
||||
DIST := dist
|
||||
|
||||
PLATFORMS := \
|
||||
linux/amd64 \
|
||||
linux/arm64 \
|
||||
darwin/amd64 \
|
||||
darwin/arm64 \
|
||||
windows/amd64
|
||||
|
||||
.PHONY: build dist clean
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)' -o rb-search .
|
||||
|
||||
dist:
|
||||
@rm -rf $(DIST)
|
||||
@mkdir -p $(DIST)
|
||||
@for plat in $(PLATFORMS); do \
|
||||
os=$${plat%/*}; arch=$${plat#*/}; \
|
||||
ext=""; if [ "$$os" = "windows" ]; then ext=".exe"; fi; \
|
||||
name=rb-search-$(VERSION)-$$os-$$arch$$ext; \
|
||||
echo " build $$name"; \
|
||||
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch \
|
||||
go build -trimpath -ldflags '$(LDFLAGS)' -o $(DIST)/$$name . || exit 1; \
|
||||
done
|
||||
@cd $(DIST) && sha256sum rb-search-* > SHA256SUMS
|
||||
@echo "built artefacts:"
|
||||
@ls -lh $(DIST)
|
||||
|
||||
clean:
|
||||
rm -rf $(DIST) rb-search
|
||||
Reference in New Issue
Block a user