gh-action-bump-version/entrypoint.sh

39 lines
1.2 KiB
Bash
Raw Normal View History

2019-01-26 21:51:06 +00:00
#!/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"}"
2019-09-10 00:21:38 +00:00
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
2019-01-26 21:51:06 +00:00
# Allow registry.npmjs.org to be overridden with an environment variable
2019-09-10 00:21:38 +00:00
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"
2019-01-26 21:51:06 +00:00
chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi
2019-09-09 23:13:08 +00:00
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
2019-09-09 23:20:39 +00:00
git config user.name "Merge Release"
git config user.email "merge-release@users.noreply.github.com"
git remote rm origin
git remote add origin "${remote_repo}"
2019-09-10 02:27:56 +00:00
git checkout master
2019-09-10 02:07:49 +00:00
git push -u origin
2019-09-09 23:13:08 +00:00
2019-05-23 19:01:06 +00:00
if [ "$GITHUB_REPOSITORY" = "mikeal/merge-release" ]
then
2019-09-09 22:09:01 +00:00
echo "node merge-release-run.js"
2019-05-23 19:08:29 +00:00
sh -c "node merge-release-run.js $*"
else
2019-09-09 22:09:01 +00:00
echo "npx merge-release"
sh -c "npx merge-release $*"
fi