test(ci): debugging why npm publish fails
Some checks failed
CI / build-and-publish (push) Failing after 1m13s

This commit is contained in:
2026-05-12 11:27:19 +03:30
parent 691dd0de92
commit 2ead714719

View File

@@ -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