diff --git a/Makefile b/Makefile index 659a80120..7eae695c1 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,27 @@ -ifeq ($(OS),Windows_NT) +IS_WIN = +ifeq (${SHELL}, sh.exe) + IS_WIN = true +endif +ifeq (${SHELL}, cmd) + IS_WIN = true +endif + +ifdef IS_WIN SEPARATOR := && SET := set +else + SEPARATOR := ; + SET := export endif release: generate ui build -build: +pre-build: $(eval DATE := $(shell go run scripts/getDate.go)) $(eval GITHASH := $(shell git rev-parse --short HEAD)) $(eval STASH_VERSION := $(shell git describe --tags --exclude latest_develop)) + +build: pre-build $(SET) CGO_ENABLED=1 $(SEPARATOR) go build -mod=vendor -v -ldflags "-X 'github.com/stashapp/stash/pkg/api.version=$(STASH_VERSION)' -X 'github.com/stashapp/stash/pkg/api.buildstamp=$(DATE)' -X 'github.com/stashapp/stash/pkg/api.githash=$(GITHASH)'" install: @@ -59,10 +72,19 @@ pre-ui: cd ui/v2.5 && yarn install --frozen-lockfile .PHONY: ui -ui: +ui: pre-build + $(SET) REACT_APP_DATE="$(DATE)" $(SEPARATOR) \ + $(SET) REACT_APP_GITHASH=$(GITHASH) $(SEPARATOR) \ + $(SET) REACT_APP_STASH_VERSION=$(STASH_VERSION) $(SEPARATOR) \ cd ui/v2.5 && yarn build packr2 +ui-start: pre-build + $(SET) REACT_APP_DATE="$(DATE)" $(SEPARATOR) \ + $(SET) REACT_APP_GITHASH=$(GITHASH) $(SEPARATOR) \ + $(SET) REACT_APP_STASH_VERSION=$(STASH_VERSION) $(SEPARATOR) \ + cd ui/v2.5 && yarn start + fmt-ui: cd ui/v2.5 && yarn format diff --git a/ui/v2.5/src/components/Changelog/Changelog.tsx b/ui/v2.5/src/components/Changelog/Changelog.tsx index 2e22c0155..d35f01a09 100644 --- a/ui/v2.5/src/components/Changelog/Changelog.tsx +++ b/ui/v2.5/src/components/Changelog/Changelog.tsx @@ -6,6 +6,14 @@ import { V010, V011, V020, V021, V030 } from "./versions"; const Changelog: React.FC = () => { const [{ data, loading }, setOpenState] = useChangelogStorage(); + const stashVersion = process.env.REACT_APP_STASH_VERSION; + const buildTime = process.env.REACT_APP_DATE; + + let buildDate; + if (buildTime) { + buildDate = buildTime.substring(0, buildTime.indexOf(" ")); + } + if (loading) return <>>; const openState = data?.versions ?? {}; @@ -22,7 +30,8 @@ const Changelog: React.FC = () => { <>
Build hash: | -{data.version.hash} | +{gitHash} |
Build time: | -{data.version.build_time} | +{buildTime} |