ci: add FFmpeg preflight workflow and helpers
This commit is contained in:
@@ -41,6 +41,31 @@ function resolveSource() {
|
||||
|
||||
function main() {
|
||||
const name = platformBinName();
|
||||
// If CI or prior steps already placed ffmpeg into resources, prefer that and skip copying.
|
||||
const existingInResources = path.join(resourcesDir, name);
|
||||
if (exists(existingInResources)) {
|
||||
console.log(`FFmpeg already present in resources: ${existingInResources} — skipping copy.`);
|
||||
process.exit(0);
|
||||
}
|
||||
// Also search recursively in resources for any ffmpeg-like file (robustness for nested archives)
|
||||
if (exists(resourcesDir)) {
|
||||
const files = fs.readdirSync(resourcesDir, { withFileTypes: true });
|
||||
const found = (function findRec(dir) {
|
||||
for (const f of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const p = path.join(dir, f.name);
|
||||
if (f.isFile() && f.name.toLowerCase().startsWith('ffmpeg')) return p;
|
||||
if (f.isDirectory()) {
|
||||
const r = findRec(p);
|
||||
if (r) return r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
})(resourcesDir);
|
||||
if (found) {
|
||||
console.log(`Found ffmpeg in resources at ${found} — skipping copy.`);
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
const src = resolveSource();
|
||||
if (!src) {
|
||||
console.log('FFmpeg not provided; skipping copy (set RADIOPLAYER_FFMPEG or place it under tools/ffmpeg/).');
|
||||
|
||||
Reference in New Issue
Block a user