From 2ead714719493e5e1909225d3635c756196f9a75 Mon Sep 17 00:00:00 2001 From: db123 Date: Tue, 12 May 2026 11:27:19 +0330 Subject: [PATCH] test(ci): debugging why npm publish fails --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8c363c..8d329b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,11 +59,31 @@ jobs: GITEA_TOKEN: ${{ secrets.G_TOKEN }} run: | set -e + + # Debug: verify token exists + if [ -z "$GITEA_TOKEN" ]; then + echo "ERROR: GITEA_TOKEN is empty!" >&2 + exit 1 + fi + + # Remove any locally-committed .npmrc to avoid conflicts + rm -f .npmrc + HOST="${GITHUB_SERVER_URL#https://}" OWNER="${GITHUB_REPOSITORY_OWNER}" + + # Build registry URL without trailing slash REGISTRY="https://${HOST}/api/packages/${OWNER}/npm" - npm config set "//${HOST}/api/packages/${OWNER}/npm/:_authToken" "${GITEA_TOKEN}" - npm config set registry "${REGISTRY}" + # Auth key MUST exactly match the registry path (also without trailing slash) + AUTH_KEY="//${HOST}/api/packages/${OWNER}/npm/:_authToken" + npm config set "$AUTH_KEY" "${GITEA_TOKEN}" + npm config set registry "$REGISTRY" + + # Double-check the effective config + echo "Effective registry: $(npm config get registry)" + echo "Token for ${HOST} is set: $(npm config get "$AUTH_KEY")" + + # Publish without --registry (uses the global config we just set) npm publish --ignore-scripts