mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-10-23 05:11:57 +00:00
feat: add version package to hold application version for build time configuration
This commit is contained in:
6
Makefile
6
Makefile
@@ -38,7 +38,7 @@ frontend-build: install-deps
|
|||||||
.PHONY: run-backend
|
.PHONY: run-backend
|
||||||
run-backend:
|
run-backend:
|
||||||
@echo "→ Running backend..."
|
@echo "→ Running backend..."
|
||||||
CGO_ENABLED=0 go run -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'main.frontendDir=frontend/dist'" cmd/*.go
|
CGO_ENABLED=0 go run -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'github.com/abhinavxd/libredesk/internal/version.Version=${VERSION}' -X 'main.frontendDir=frontend/dist'" cmd/*.go
|
||||||
|
|
||||||
# Run the JS frontend server in development mode.
|
# Run the JS frontend server in development mode.
|
||||||
.PHONY: run-frontend
|
.PHONY: run-frontend
|
||||||
@@ -52,8 +52,8 @@ run-frontend:
|
|||||||
.PHONY: build-backend
|
.PHONY: build-backend
|
||||||
build-backend: $(STUFFBIN)
|
build-backend: $(STUFFBIN)
|
||||||
@echo "→ Building backend..."
|
@echo "→ Building backend..."
|
||||||
@CGO_ENABLED=0 go build -a\
|
@CGO_ENABLED=0 go build -a \
|
||||||
-ldflags="-X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -s -w" \
|
-ldflags="-X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'github.com/abhinavxd/libredesk/internal/version.Version=${VERSION}' -s -w" \
|
||||||
-o ${BIN} cmd/*.go
|
-o ${BIN} cmd/*.go
|
||||||
|
|
||||||
# Main build target: builds both frontend and backend, then stuffs static assets into the binary.
|
# Main build target: builds both frontend and backend, then stuffs static assets into the binary.
|
||||||
|
5
internal/version/version.go
Normal file
5
internal/version/version.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
// Version holds the current version of the application.
|
||||||
|
// This value is intended to be set at build time using the -X linker flag.
|
||||||
|
var Version = "unknown-version"
|
Reference in New Issue
Block a user