Use SOURCE_COMMIT w/ nixpacks
All checks were successful
Build and test project / build-and-test (push) Successful in 1m27s
All checks were successful
Build and test project / build-and-test (push) Successful in 1m27s
This commit is contained in:
@@ -83,22 +83,28 @@ if (existsSync(workerSrc)) {
|
||||
// Get git version string
|
||||
let versionStr = 'unknown';
|
||||
let versionLink = 'https://github.com/nicoverbruggen/kobopatch-webui';
|
||||
const nixpacksCommit = process.env.SOURCE_COMMIT;
|
||||
try {
|
||||
const hash = String(execSync('git rev-parse --short HEAD', { cwd: repoDir })).trim();
|
||||
|
||||
let tag = '';
|
||||
try {
|
||||
tag = String(execSync('git describe --tags --exact-match 2>/dev/null', { cwd: repoDir })).trim();
|
||||
} catch {}
|
||||
if (tag) {
|
||||
versionStr = tag;
|
||||
const dirty = String(execSync('git status --porcelain', { cwd: repoDir })).trim();
|
||||
if (dirty) versionStr += ' (D)';
|
||||
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/releases/tag/${tag}`;
|
||||
if (nixpacksCommit) {
|
||||
versionStr = nixpacksCommit.slice(0, 7);
|
||||
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/commit/${nixpacksCommit}`;
|
||||
} else {
|
||||
const dirty = String(execSync('git status --porcelain', { cwd: repoDir })).trim();
|
||||
versionStr = dirty ? `${hash} (D)` : hash;
|
||||
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/commit/${hash}`;
|
||||
const hash = String(execSync('git rev-parse --short HEAD', { cwd: repoDir })).trim();
|
||||
|
||||
let tag = '';
|
||||
try {
|
||||
tag = String(execSync('git describe --tags --exact-match 2>/dev/null', { cwd: repoDir })).trim();
|
||||
} catch {}
|
||||
if (tag) {
|
||||
versionStr = tag;
|
||||
const dirty = String(execSync('git status --porcelain', { cwd: repoDir })).trim();
|
||||
if (dirty) versionStr += ' (D)';
|
||||
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/releases/tag/${tag}`;
|
||||
} else {
|
||||
const dirty = String(execSync('git status --porcelain', { cwd: repoDir })).trim();
|
||||
versionStr = dirty ? `${hash} (D)` : hash;
|
||||
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/commit/${hash}`;
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user