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
|
// Get git version string
|
||||||
let versionStr = 'unknown';
|
let versionStr = 'unknown';
|
||||||
let versionLink = 'https://github.com/nicoverbruggen/kobopatch-webui';
|
let versionLink = 'https://github.com/nicoverbruggen/kobopatch-webui';
|
||||||
|
const nixpacksCommit = process.env.SOURCE_COMMIT;
|
||||||
try {
|
try {
|
||||||
const hash = String(execSync('git rev-parse --short HEAD', { cwd: repoDir })).trim();
|
if (nixpacksCommit) {
|
||||||
|
versionStr = nixpacksCommit.slice(0, 7);
|
||||||
let tag = '';
|
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/commit/${nixpacksCommit}`;
|
||||||
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 {
|
} else {
|
||||||
const dirty = String(execSync('git status --porcelain', { cwd: repoDir })).trim();
|
const hash = String(execSync('git rev-parse --short HEAD', { cwd: repoDir })).trim();
|
||||||
versionStr = dirty ? `${hash} (D)` : hash;
|
|
||||||
versionLink = `https://github.com/nicoverbruggen/kobopatch-webui/commit/${hash}`;
|
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 {}
|
} catch {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user