36 lines
1.2 KiB
Bash
Executable File
36 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [ -n "$NPM_AUTH_TOKEN" ]; then
|
|
# Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
|
|
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
|
|
NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}"
|
|
NPM_STRICT_SSL="${NPM_STRICT_SSL-true}"
|
|
NPM_REGISTRY_SCHEME="https"
|
|
if ! $NPM_STRICT_SSL
|
|
then
|
|
NPM_REGISTRY_SCHEME="http"
|
|
fi
|
|
|
|
# Allow registry.npmjs.org to be overridden with an environment variable
|
|
printf "//%s/:_authToken=%s\\nregistry=%s\\nstrict-ssl=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "${NPM_REGISTRY_SCHEME}://$NPM_REGISTRY_URL" "${NPM_STRICT_SSL}" > "$NPM_CONFIG_USERCONFIG"
|
|
|
|
chmod 0600 "$NPM_CONFIG_USERCONFIG"
|
|
fi
|
|
|
|
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
|
|
|
git config user.name "Bump Version"
|
|
git config user.email "gh-action-bump-version@users.noreply.github.com"
|
|
git remote add gh-action-bump-version "${remote_repo}"
|
|
|
|
if [ "$GITHUB_REPOSITORY" = "phips28/gh-action-bump-version" ]
|
|
then
|
|
echo "node gh-action-bump-version-run.js"
|
|
sh -c "node gh-action-bump-version-run.js $*"
|
|
else
|
|
echo "npx gh-action-bump-version"
|
|
sh -c "npx gh-action-bump-version $*"
|
|
fi
|