From 583a3797f3dcd4c9bc0ae1031ff95862010040fe Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 3 Mar 2026 12:54:17 +0100 Subject: [PATCH] fix(ci): use explicit registry token instead of GITHUB_TOKEN for docker login --- .gitea/workflows/deploy.yml | 4 ++-- scripts/generate-pdf-datasheets-pdf-lib.ts | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index aad3a6a2..fe1a9d90 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -203,7 +203,7 @@ jobs: - name: 🐳 Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: 🔐 Registry Login - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.infra.mintel.me -u "${{ github.actor }}" --password-stdin + run: echo "${{ secrets.REGISTRY_PASS }}" | docker login git.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin - name: 🏗️ Build and Push uses: docker/build-push-action@v5 with: @@ -363,7 +363,7 @@ jobs: scp .env.deploy root@alpha.mintel.me:$SITE_DIR/$ENV_FILE scp docker-compose.yml root@alpha.mintel.me:$SITE_DIR/docker-compose.yml - ssh root@alpha.mintel.me "cd $SITE_DIR && echo '${{ secrets.GITHUB_TOKEN }}' | docker login git.infra.mintel.me -u '${{ github.actor }}' --password-stdin" + ssh root@alpha.mintel.me "cd $SITE_DIR && echo '${{ secrets.REGISTRY_PASS }}' | docker login git.infra.mintel.me -u '${{ secrets.REGISTRY_USER }}' --password-stdin" ssh root@alpha.mintel.me "cd $SITE_DIR && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file '$ENV_FILE' pull" ssh root@alpha.mintel.me "cd $SITE_DIR && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file '$ENV_FILE' up -d --remove-orphans" diff --git a/scripts/generate-pdf-datasheets-pdf-lib.ts b/scripts/generate-pdf-datasheets-pdf-lib.ts index 77a2aa04..eb88775f 100644 --- a/scripts/generate-pdf-datasheets-pdf-lib.ts +++ b/scripts/generate-pdf-datasheets-pdf-lib.ts @@ -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= 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= 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