fix(ci): use explicit registry token instead of GITHUB_TOKEN for docker login

This commit is contained in:
2026-03-03 12:54:17 +01:00
parent 655f33091f
commit 583a3797f3
2 changed files with 15 additions and 10 deletions

View File

@@ -3122,13 +3122,19 @@ async function loadEmbeddablePng(
try {
// Prefer local files for stability and speed.
if (resolved.startsWith('/')) {
const bytes = await readBytesFromPublic(resolved);
return { pngBytes: await toPngBytes(bytes, resolved), debugLabel: resolved };
try {
const bytes = await readBytesFromPublic(resolved);
return { pngBytes: await toPngBytes(bytes, resolved), debugLabel: resolved };
} catch {
// Fall back to HTTP fetch if file doesn't exist locally (e.g., Payload /api/ route)
}
}
// Remote (fallback)
const bytes = await fetchBytes(resolved);
return { pngBytes: await toPngBytes(bytes, resolved), debugLabel: resolved };
const host = process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000';
const fetchUrl = resolved.startsWith('/') ? `${host}${resolved}` : resolved;
const bytes = await fetchBytes(fetchUrl);
return { pngBytes: await toPngBytes(bytes, fetchUrl), debugLabel: fetchUrl };
} catch {
return null;
}
@@ -3969,7 +3975,7 @@ async function generatePDF(product: ProductData, locale: 'en' | 'de'): Promise<B
// Assets
// Prefer a raster logo for reliability (sharp SVG support can vary between environments).
const logoPng =
(await loadEmbeddablePng('/media/logo.png')) || (await loadEmbeddablePng('/media/logo.svg'));
(await loadEmbeddablePng('/logo.png')) || (await loadEmbeddablePng('/logo.svg'));
const logoImage = logoPng ? await pdfDoc.embedPng(logoPng.pngBytes) : null;
// Some products have no product-specific images.
@@ -4308,8 +4314,7 @@ async function generatePDF(product: ProductData, locale: 'en' | 'de'): Promise<B
hasRenderedContent = true;
// Add spacing after technical data section before first voltage table
if (y - 20 >= contentMinY) y -= 20;
// Gap before the first voltage table is handled globally in the tables loop below to ensure it's proportional.
}
// CROSS-SECTION DATA: one table per voltage rating
@@ -4318,7 +4323,7 @@ async function generatePDF(product: ProductData, locale: 'en' | 'de'): Promise<B
for (const t of tables) {
// Maintain a minimum space between tables (even when staying on the same page).
// This avoids visual collisions between the previous table and the next meta header.
if (hasRenderedContent && y - 20 >= contentMinY) y -= 20;
if (hasRenderedContent && y - 24 >= contentMinY) y -= 24;
// Check if we need a new page for this voltage table
// Estimate: meta block (if shown) + table header + at least 3 data rows