From 219bc5f01be994f1873e5a21b3487b0419663365 Mon Sep 17 00:00:00 2001 From: Mikeal Rogers Date: Mon, 9 Sep 2019 19:24:33 +0000 Subject: [PATCH] fix: setup git repo for push --- merge-release-run.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/merge-release-run.js b/merge-release-run.js index 6faecbc..67fe96a 100644 --- a/merge-release-run.js +++ b/merge-release-run.js @@ -46,13 +46,23 @@ const run = async () => { version = 'minor' } + const run = str => process.stdout.write(execSync(str)) + + /* configure git */ + const { GITHUB_ACTOR, GITHUB_TOKEN, GITHUB_REPOSITORY } = process.env + const remote = `https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git` + run(`git remote rm origin`) + run(`git remote add origin ${remote}`) + run(`git config user.name "Merge Release"`) + run(`git config user.email "merge-release@users.noreply.github.com"`) + let current = execSync(`npm view ${pkg.name} version`).toString() process.stdout.write(execSync(`npm version --allow-same-version=true --git-tag-version=false ${current} `)) let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString() console.log(newVersion) - process.stdout.write(execSync(`git commit -a --amend --no-edit`)) - process.stdout.write(execSync(`npm publish --access=public`)) - process.stdout.write(execSync(`git push`)) + run(`git commit -a --amend --no-edit`) + run(`npm publish --access=public`) + run(`git push`) await git.addTag(newVersion) await git.pushTags('origin') }