Skip to content

Commit 2b966e4

Browse files
committed
publish-npm-package: for maximum security, only display .npmrc when auto-generated
1 parent a9d80fe commit 2b966e4

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

actions/publish-npm-package/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ steps:
3131

3232
1. Run `publish-github-pages` with the `optional` flag enabled.
3333

34-
1. If the `.npmrc` file does not exist, generate a new one - publishing to the official npm registry and using the **NPM_TOKEN** environment variable as the authentication token.
34+
1. If the `.npmrc` file does not exist, generate a new one - publishing to the official npm registry and using the **NPM_TOKEN** environment variable as the authentication token. The `.npmrc` file will be displayed only if auto-generated.
3535

3636
1. Run `pnpm publish`, with the value of `npm-token` injected into the **NPM_TOKEN** environment variable - accessible, for example, from the `.npmrc` configuration file.
3737

actions/publish-npm-package/action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,13 @@ runs:
108108
echo "🌟It seems you don't have a $npmConfigPath file - generating a default one..."
109109
110110
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > "$npmConfigPath"
111-
fi
112111
113-
echo "🎀The content of the $npmConfigPath configuration file is:"
114-
cat "$npmConfigPath"
115-
echo "🎀🎀🎀"
112+
echo "🎀Your auto-generated $npmConfigPath configuration file is:"
113+
cat "$npmConfigPath"
114+
echo "🎀🎀🎀"
115+
else
116+
echo "🌟You already have a custom $npmConfigPath file - ready to publish!"
117+
fi
116118
117119
- name: Publish to the registry
118120
shell: bash

0 commit comments

Comments
 (0)