fix(version): compose version+commit label when git describe is unavailable
Coolify builds have no git metadata, so fall back to <semver>+<commit sha> in both the version overlay and version-info generator instead of showing a bare version. Ultraworked with [Sisyphus](https://github.com/code-yeongju/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
3bc689d572
commit
db5745d458
2 changed files with 8 additions and 2 deletions
|
|
@ -16,7 +16,13 @@ const EMPTY: VersionInfo = {
|
|||
};
|
||||
|
||||
function resolveVersionLabel(info: VersionInfo): string {
|
||||
return info.gitDescribe ?? info.tag ?? info.version ?? "unknown version";
|
||||
// Coolify strips .git from the build context, so only commitHash (via the
|
||||
// SOURCE_COMMIT build arg) resolves there — compose it into the label so
|
||||
// every deploy shows a distinct version without a manual semver bump.
|
||||
if (info.gitDescribe) return info.gitDescribe;
|
||||
if (info.tag) return info.tag;
|
||||
if (info.version && info.commitHash) return `${info.version}+${info.commitHash}`;
|
||||
return info.version ?? "unknown version";
|
||||
}
|
||||
|
||||
function formatCommitDate(iso: string | null): string | null {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ function main(): void {
|
|||
"utf8",
|
||||
);
|
||||
|
||||
const label = gitDescribe ?? tag ?? version ?? "unknown";
|
||||
const label = gitDescribe ?? tag ?? (version && commitHash ? `${version}+${commitHash}` : null) ?? version ?? "unknown";
|
||||
console.log(`[version-info] wrote src/generated/versionInfo.json (${label})`);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue