Skip to content

Self-improving AI Employees for everyone

Fix CI install test and Docker build failures

trohitg7b7a5a3a737d
diff --git a/.github/workflows/predeploy.yml b/.github/workflows/predeploy.yml
index d980aed7..e039aae6 100644
--- a/.github/workflows/predeploy.yml
+++ b/.github/workflows/predeploy.yml
@@ -123,6 +123,9 @@ jobs:
- name: Test global install
shell: bash
+ env:
+ CI: 'false'
+ GITHUB_ACTIONS: 'false'
run: |
npm install -g machinaos-*.tgz
diff --git a/client/Dockerfile b/client/Dockerfile
index c68a565f..3f5cc661 100644
--- a/client/Dockerfile
+++ b/client/Dockerfile
@@ -41,12 +41,14 @@ ARG VITE_AUTH_ENABLED=true
ARG VITE_PYTHON_SERVICE_URL=
ARG VITE_WHATSAPP_SERVICE_URL=
ARG VITE_ANDROID_RELAY_URL=
+ARG VITE_APP_VERSION=0.0.0
# Expose build args as environment variables for Vite build
ENV VITE_AUTH_ENABLED=$VITE_AUTH_ENABLED
ENV VITE_PYTHON_SERVICE_URL=$VITE_PYTHON_SERVICE_URL
ENV VITE_WHATSAPP_SERVICE_URL=$VITE_WHATSAPP_SERVICE_URL
ENV VITE_ANDROID_RELAY_URL=$VITE_ANDROID_RELAY_URL
+ENV VITE_APP_VERSION=$VITE_APP_VERSION
# Increase Node.js memory limit for large builds (GCP e2-micro has limited RAM)
ENV NODE_OPTIONS="--max-old-space-size=2048"
diff --git a/client/src/utils/workflowExport.ts b/client/src/utils/workflowExport.ts
index 0f68e377..bf900528 100644
--- a/client/src/utils/workflowExport.ts
+++ b/client/src/utils/workflowExport.ts
@@ -6,10 +6,9 @@
import { Node } from 'reactflow';
import { WorkflowData } from '../store/useAppStore';
import { validateWorkflow, serializeWorkflow, deserializeWorkflow } from '../schemas/workflowSchema';
-import packageJson from '../../../package.json';
-
-// Use project version from package.json for workflow exports
-const APP_VERSION = packageJson.version;
+// Injected by Vite define from root package.json (see vite.config.js)
+declare const __APP_VERSION__: string;
+const APP_VERSION = typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : '0.0.0';
// Fields allowed in node.data for export/save - everything else is parameter data
// that belongs in the DB and should not leak into exported JSON files.
diff --git a/client/vite.config.js b/client/vite.config.js
index 3f89633f..69a9e0a5 100644
--- a/client/vite.config.js
+++ b/client/vite.config.js
@@ -1,6 +1,15 @@
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
+import { readFileSync } from 'fs'
+
+// Read root package.json for app version (one level up from client/)
+// Falls back to '0.0.0' in Docker where only client/ is in the build context
+let appVersion = '0.0.0'
+try {
+ const rootPkg = JSON.parse(readFileSync(resolve(process.cwd(), '..', 'package.json'), 'utf-8'))
+ appVersion = rootPkg.version
+} catch { /* Docker build - root package.json not available */ }
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
@@ -13,10 +22,14 @@ export default defineConfig(({ mode }) => {
return process.env[key] || fileEnv[key] || defaultValue
}
+ // APP_VERSION: from root package.json locally, or VITE_APP_VERSION build arg in Docker
+ const version = getEnv('VITE_APP_VERSION', '') || appVersion
+
return {
plugins: [react()],
// Expose VITE_ prefixed env vars to client code via import.meta.env
define: {
+ __APP_VERSION__: JSON.stringify(version),
'import.meta.env.VITE_AUTH_ENABLED': JSON.stringify(getEnv('VITE_AUTH_ENABLED', 'true')),
'import.meta.env.VITE_PYTHON_SERVICE_URL': JSON.stringify(getEnv('VITE_PYTHON_SERVICE_URL', '')),
'import.meta.env.VITE_WHATSAPP_SERVICE_URL': JSON.stringify(getEnv('VITE_WHATSAPP_SERVICE_URL', '')),