feat: configure repo for push

This commit is contained in:
Mikeal Rogers 2019-09-09 23:13:08 +00:00
parent 1ec3988ca2
commit bff8e70f4a
1 changed files with 8 additions and 1 deletions

View File

@ -5,7 +5,7 @@ set -e
if [ -n "$NPM_AUTH_TOKEN" ]; then if [ -n "$NPM_AUTH_TOKEN" ]; then
# Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc # Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}" NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}" NPM_REGISTRY_URL="${NPM_REGISTRY_URL-https://registry.npmjs.org}"
# Allow registry.npmjs.org to be overridden with an environment variable # Allow registry.npmjs.org to be overridden with an environment variable
printf "//%s/:_authToken=%s\\nregistry=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "$NPM_REGISTRY_URL" > "$NPM_CONFIG_USERCONFIG" printf "//%s/:_authToken=%s\\nregistry=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "$NPM_REGISTRY_URL" > "$NPM_CONFIG_USERCONFIG"
@ -14,6 +14,13 @@ fi
sh -c "git checkout master" sh -c "git checkout master"
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
sh -c 'git config user.name "Automated Publisher"'
sh -c 'git config user.email "publish-to-github-action@users.noreply.github.com"'
sh -c 'git remote rm origin'
sh -c 'git remote add origin "${remote_repo}"'
if [ "$GITHUB_REPOSITORY" = "mikeal/merge-release" ] if [ "$GITHUB_REPOSITORY" = "mikeal/merge-release" ]
then then
echo "node merge-release-run.js" echo "node merge-release-run.js"