fix: change branch and tag strategy

This commit is contained in:
Mikeal Rogers 2019-09-10 02:07:49 +00:00
parent 9dccc0180c
commit da67840952
2 changed files with 7 additions and 4 deletions

View File

@ -19,14 +19,13 @@ if [ -n "$NPM_AUTH_TOKEN" ]; then
chmod 0600 "$NPM_CONFIG_USERCONFIG" chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi fi
sh -c "git checkout master"
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config user.name "Merge Release" git config user.name "Merge Release"
git config user.email "merge-release@users.noreply.github.com" git config user.email "merge-release@users.noreply.github.com"
git remote rm origin git remote rm origin
git remote add origin "${remote_repo}" git remote add origin "${remote_repo}"
git push -u origin
if [ "$GITHUB_REPOSITORY" = "mikeal/merge-release" ] if [ "$GITHUB_REPOSITORY" = "mikeal/merge-release" ]
then then

View File

@ -52,15 +52,19 @@ const run = async () => {
const exec = str => process.stdout.write(execSync(str)) const exec = str => process.stdout.write(execSync(str))
exec(`git branch tmp`)
let current = execSync(`npm view ${pkg.name} version`).toString() let current = execSync(`npm view ${pkg.name} version`).toString()
exec(`npm version --allow-same-version=true --git-tag-version=false ${current} `) exec(`npm version --allow-same-version=true --git-tag-version=false ${current} `)
console.log('current:', current, '/', 'version:', version) console.log('current:', current, '/', 'version:', version)
let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString() let newVersion = execSync(`npm version --git-tag-version=false ${version}`).toString()
console.log('new version:', newVersion) console.log('new version:', newVersion)
exec(`git commit -a --amend --no-edit`) exec(`git commit -a --amend --no-edit`)
exec(`git checkout master`)
exec(`git merge tmp`)
exec(`npm publish --access=public`) exec(`npm publish --access=public`)
exec(`git push origin master`) exec(`git push origin master`)
await git.addTag(newVersion) exec(`git tag ${newVersion}`)
await git.pushTags('origin') exec(`git push origin --tags`)
} }
run() run()