Compare commits

...

4 Commits

Author SHA1 Message Date
ZhaiSoul
df420783eb build: use vite .env 2025-11-13 05:50:08 +00:00
GuoQing Liu
52e6fbebd2
Update build args to use short SHA output 2025-11-13 00:07:49 +08:00
GuoQing Liu
78c3108d94
Add short-sha output to action.yml 2025-11-13 00:06:28 +08:00
GuoQing Liu
230a397d0f
Add build argument for GIT_COMMIT_HASH in CI workflow 2025-11-12 23:46:49 +08:00
6 changed files with 4 additions and 6 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ frigate/version.py
web/build
web/node_modules
web/coverage
web/.env
core
!/web/**/*.ts
.idea/*

View File

@ -14,6 +14,7 @@ push-boards: $(BOARDS:%=push-%)
version:
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
echo 'VITE_GIT_COMMIT_HASH=$(COMMIT_HASH)' > web/.env
local: version
docker buildx build --target=frigate --file docker/main/Dockerfile . \

View File

@ -319,9 +319,6 @@ FROM --platform=$BUILDPLATFORM node:20 AS web-build
WORKDIR /work
COPY web/package.json web/package-lock.json ./
ARG GIT_COMMIT_HASH
ENV GIT_COMMIT_HASH=$GIT_COMMIT_HASH
RUN npm install
COPY web/ ./

1
web/.gitignore vendored
View File

@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env

View File

@ -33,7 +33,7 @@ i18n
fallbackLng: "en", // use en if detected lng is not available
backend: {
loadPath: `locales/{{lng}}/{{ns}}.json?v=${import.meta.env.GIT_COMMIT_HASH || "unknown"}`,
loadPath: `locales/{{lng}}/{{ns}}.json?v=${import.meta.env.VITE_GIT_COMMIT_HASH || "unknown"}`,
},
ns: [

View File

@ -5,12 +5,10 @@ import react from "@vitejs/plugin-react-swc";
import monacoEditorPlugin from "vite-plugin-monaco-editor";
const proxyHost = process.env.PROXY_HOST || "localhost:5000";
const gitCommitHash = process.env.GIT_COMMIT_HASH || "unknown";
// https://vitejs.dev/config/
export default defineConfig({
define: {
"import.meta.vitest": "undefined",
"import.meta.env.GIT_COMMIT_HASH": JSON.stringify(gitCommitHash),
},
server: {
proxy: {