publish binary - #15
Conversation
| --compile \ | ||
| --minify \ | ||
| --target=${{ matrix.target }} \ | ||
| --define="process.env.DASHBOARD_SERVER_VERSION=\"${{ needs.build.outputs.new_version }}\"" \ |
There was a problem hiding this comment.
🟡 Compiled binary will always report 'unknown' version due to unused --define flag
The workflow passes --define="process.env.DASHBOARD_SERVER_VERSION=\"${{ needs.build.outputs.new_version }}\"" to bun build --compile, but the getVersion() function in start.ts never checks this environment variable.
Click to expand
Root Cause
The getVersion() function at packages/dashboard-server/src/start.ts:18-38 only reads version from package.json files on disk:
function getVersion(): string {
// Walk up to find package.json
let dir = __dirname;
for (let i = 0; i < 5; i++) {
const pkgPath = join(dir, 'package.json');
if (existsSync(pkgPath)) {
// ... reads from package.json
}
}
return 'unknown';
}When the binary is compiled with bun build --compile, the package.json file is not bundled with the binary. The workflow at line 241 attempts to inject the version via --define, but this value is never used.
Actual vs Expected
Actual: Running ./relay-dashboard-server --version will output unknown
Expected: Running ./relay-dashboard-server --version should output the actual version (e.g., 2.0.50)
Impact
Users downloading the standalone binary won't be able to verify which version they have installed, making it difficult to troubleshoot issues or verify they have the latest version.
Recommendation: Modify getVersion() in packages/dashboard-server/src/start.ts to check process.env.DASHBOARD_SERVER_VERSION first before falling back to reading from package.json:
function getVersion(): string {
// Check for compile-time injected version first (for standalone binaries)
if (process.env.DASHBOARD_SERVER_VERSION) {
return process.env.DASHBOARD_SERVER_VERSION;
}
// Fall back to reading from package.json...
}Was this helpful? React with 👍 or 👎 to provide feedback.
Uh oh!
There was an error while loading. Please reload this page.