feat(release): v0.4.0 foundations — ldflags version + goreleaser + CI Go 1.24
- Move version out of cmd/root.go hardcode into an ldflags-injected var. Makefile derives from 'git describe --tags --always --dirty'; plain 'go build' / 'go run' get 'dev'. Release builds will get the tag via goreleaser. - Add .goreleaser.yaml: multi-platform (linux/darwin/windows/freebsd × amd64/arm64/arm) builds with SHA256 checksums, tar.gz/zip archives, forgejo release publishing. No GPG/S3 yet — deferred until a key is provisioned. - Add .gitea/workflows/release.yml to run goreleaser on tag push. Uses built-in GITEA_TOKEN with override via RELEASE_TOKEN secret. - Align CI Go version with go.mod (1.24). Previously CI ran 1.21, which would have silently missed any 1.22+ feature use. - Move itchyny/gojq from indirect to direct (it's used in api.go). Drop stale x/sys v0.33.0 entry from go.sum. - Ignore dist/ and bin/ in .gitignore. - CHANGELOG: document v0.3.1 fix and Unreleased development changes.
This commit is contained in:
parent
a6cf9a7096
commit
d4b5b79541
10 changed files with 188 additions and 13 deletions
20
Makefile
20
Makefile
|
|
@ -1,17 +1,23 @@
|
|||
.PHONY: help build run test clean lint lint-fix install
|
||||
.PHONY: help build run test clean lint lint-fix install release-snapshot release-check
|
||||
|
||||
# Version derived from git tags; falls back to short SHA; appends -dirty if tree is modified.
|
||||
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||
LDFLAGS := -X 'forgejo.zerova.net/public/fgj-sid/cmd.version=$(VERSION)'
|
||||
|
||||
help:
|
||||
@echo "Available commands:"
|
||||
@echo " make build - Build the application"
|
||||
@echo " make build - Build the application (version: $(VERSION))"
|
||||
@echo " make install - Install the binary to /usr/bin"
|
||||
@echo " make run - Run the application"
|
||||
@echo " make test - Run tests"
|
||||
@echo " make lint - Run golangci-lint"
|
||||
@echo " make lint-fix - Run golangci-lint with auto-fix"
|
||||
@echo " make clean - Clean build artifacts"
|
||||
@echo " make release-snapshot - Build snapshot release artifacts via goreleaser"
|
||||
@echo " make release-check - Validate .goreleaser.yaml"
|
||||
|
||||
build:
|
||||
go build -o bin/fgj .
|
||||
go build -ldflags "$(LDFLAGS)" -o bin/fgj .
|
||||
|
||||
install: build
|
||||
install -Dm755 bin/fgj /usr/bin/fgj
|
||||
|
|
@ -29,5 +35,11 @@ lint-fix:
|
|||
golangci-lint run --fix ./...
|
||||
|
||||
clean:
|
||||
rm -rf bin/
|
||||
rm -rf bin/ dist/
|
||||
go clean
|
||||
|
||||
release-snapshot:
|
||||
goreleaser release --snapshot --clean --skip=publish
|
||||
|
||||
release-check:
|
||||
goreleaser check
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue