Skip to content

Commit

Permalink
feat: make publishing to npm optional
Browse files Browse the repository at this point in the history
  • Loading branch information
snickbit committed Oct 30, 2022
1 parent 59abd31 commit a2413b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "Release please workflow with npm, git, pnpm, and pre-release scrip
inputs:
NPM_TOKEN:
description: NPM Token
required: true
required: false
GITHUB_TOKEN:
description: GitHub Personal Access Token
required: false
Expand Down
12 changes: 7 additions & 5 deletions release.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Auth
NPM_TOKEN=${NPM_TOKEN:-${NPM_AUTH_TOKEN:-}}
NPM_TOKEN=${NPM_TOKEN:-}
NPM_REGISTRY=${NPM_REGISTRY:-"//registry.npmjs.org/"}

[[ "$NPM_REGISTRY" =~ /$ ]] || NPM_REGISTRY="$NPM_REGISTRY/"
Expand Down Expand Up @@ -71,7 +71,7 @@ runScript() {
function publish() {
if [[ -n "$PUBLISH_SCRIPT" ]]; then
runScript "$PUBLISH_SCRIPT"
else
elif [[ -n "$NPM_TOKEN" ]] && ! jq -e ".private" package.json > /dev/null; then
if [ "$DRY_RUN" = true ] || [[ "$DRY_RUN" == "publish-only" ]]; then
$PUBLISH_COMMAND --dry-run
else
Expand All @@ -80,9 +80,11 @@ function publish() {
fi
}

# Set NPM_TOKEN
echo "Configuring NPM Token"
npm config set "$NPM_REGISTRY" "$NPM_TOKEN"
if [[ -n "$NPM_TOKEN" ]]; then
# Set NPM_TOKEN
echo "Configuring NPM authentication"
npm config set "$NPM_REGISTRY" "$NPM_TOKEN"
fi

echo "Install dependencies"
pnpm install --frozen-lockfile
Expand Down

0 comments on commit a2413b3

Please sign in to comment.