File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 5454if [ -n " ${NPM_PUBLISH_TOKEN:- } " ]; then
5555 echo " 🔑 Found NPM_PUBLISH_TOKEN in .env"
5656
57- # create temp npmrc
58- TEMP_NPMRC=$( mktemp)
59- echo " //registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN} " > " $TEMP_NPMRC "
57+ # Use a local file for compatibility with Windows npm (avoids /tmp path issues)
58+ TEMP_NPMRC_NAME=" .npmrc-publish-temp"
59+ echo " //registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN} " > " $TEMP_NPMRC_NAME "
60+
61+ # Determine the path format for the environment variable
62+ if command -v cygpath > /dev/null 2>&1 ; then
63+ # Git Bash on Windows - convert to Windows path for the env var
64+ TEMP_NPMRC=$( cygpath -w " $PWD /$TEMP_NPMRC_NAME " )
65+ else
66+ # Standard - use absolute unix path
67+ TEMP_NPMRC=" $PWD /$TEMP_NPMRC_NAME "
68+ fi
6069
61- # Validate token
62- if ! npm whoami --userconfig " $TEMP_NPMRC " > /dev/null 2>&1 ; then
70+ # Validate token (using local file name for bash command to be safe)
71+ if ! npm whoami --userconfig " $TEMP_NPMRC_NAME " > /dev/null 2>&1 ; then
6372 echo " ❌ Error: The NPM_PUBLISH_TOKEN in .env is invalid or expired." >&2
6473 echo " Please regenerate the token." >&2
6574 exit 1
6675 fi
6776
68- echo " ✅ Token validated. User: $( npm whoami --userconfig " $TEMP_NPMRC " ) "
77+ echo " ✅ Token validated. User: $( npm whoami --userconfig " $TEMP_NPMRC_NAME " ) "
78+
79+ # Export the OS-appropriate path for the sub-process
6980 export NPM_CONFIG_USERCONFIG=" $TEMP_NPMRC "
7081
7182else
You can’t perform that action at this time.
0 commit comments