test(ci): debugging why npm publish fails
Some checks failed
CI / build-and-publish (push) Failing after 1m13s
Some checks failed
CI / build-and-publish (push) Failing after 1m13s
This commit is contained in:
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -59,11 +59,31 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
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://}"
|
HOST="${GITHUB_SERVER_URL#https://}"
|
||||||
OWNER="${GITHUB_REPOSITORY_OWNER}"
|
OWNER="${GITHUB_REPOSITORY_OWNER}"
|
||||||
|
|
||||||
|
# Build registry URL without trailing slash
|
||||||
REGISTRY="https://${HOST}/api/packages/${OWNER}/npm"
|
REGISTRY="https://${HOST}/api/packages/${OWNER}/npm"
|
||||||
|
|
||||||
npm config set "//${HOST}/api/packages/${OWNER}/npm/:_authToken" "${GITEA_TOKEN}"
|
# Auth key MUST exactly match the registry path (also without trailing slash)
|
||||||
npm config set registry "${REGISTRY}"
|
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
|
npm publish --ignore-scripts
|
||||||
|
|||||||
Reference in New Issue
Block a user