From 7d9be5bf772ae84fc7692e70575abb9d43ba7cd2 Mon Sep 17 00:00:00 2001 From: Scion Date: Thu, 1 Jan 2026 19:33:37 -0800 Subject: [PATCH] Test --- npm/npm-push/action.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/npm/npm-push/action.yaml b/npm/npm-push/action.yaml index a079e6e..ff00b92 100644 --- a/npm/npm-push/action.yaml +++ b/npm/npm-push/action.yaml @@ -26,10 +26,7 @@ runs: uses: https://github.com/actions/setup-node@v4 with: node-version: ${{ inputs.nodeVersion }} - registry-url: ${{ inputs.registry }} - name: "Publish package" - env: - NODE_AUTH_TOKEN: ${{ inputs.apiKey }} run: | # Ensure path starts with ./ so npm recognizes it as a file path TGZ_PATH="${{ inputs.tgz }}" @@ -37,8 +34,19 @@ runs: TGZ_PATH="./$TGZ_PATH" fi + # Configure npm authentication for the registry (scoped to project) + REGISTRY_HOST=$(echo "${{ inputs.registry }}" | sed -E 's|https?://([^/]+).*|\1|') + npm config set --location=project "//${REGISTRY_HOST}/:_authToken" "${{ inputs.apiKey }}" + npm config set --location=project registry "${{ inputs.registry }}" + echo "Publishing $TGZ_PATH to ${{ inputs.registry }}" npm publish "$TGZ_PATH" --access ${{ inputs.access }} echo "Package published successfully" shell: bash + - name: "Clean up npm authentication" + if: always() + run: | + # Clean up project .npmrc in case of early exit + rm -f .npmrc + shell: bash \ No newline at end of file