Skip to content

Commit 0b79f0c

Browse files
authored
Merge pull request #7 from chojs23/feat/version
Make plugin builds derive --version from git metadata
2 parents 3ab4adf + a36586c commit 0b79f0c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ BINARY_NAME=im-switch
22
BUILD_DIR=build
33
INSTALL_DIR=/usr/local/bin
44
WSL_WIN_OUT ?= /mnt/c/Tools/im-switch.exe
5-
VERSION ?= dev
5+
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
66
GO_LDFLAGS := -X main.version=$(VERSION)
77

88
# Detect operating system
@@ -46,7 +46,7 @@ else
4646
endif
4747

4848
# Alias for the binary target
49-
build: $(BINARY_NAME)
49+
build: force-build
5050

5151
# Force rebuild regardless of timestamps
5252
force-build:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ If you need to build the binary manually:
256256
# Build for development
257257
make build
258258

259+
# By default, the binary version is derived from git metadata.
260+
# You can override it when building from a source archive without .git.
261+
make build VERSION=v1.2.3
262+
259263
# Build optimized release version
260264
make build-release VERSION=v1.2.3
261265

0 commit comments

Comments
 (0)