Skip to content

Commit

Permalink
perf: move side effects below dry-run check
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jul 23, 2022
1 parent 27cdef5 commit 8adcb14
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
const [,,repoHost, repoName] = originUrl.replace(':', '/').replace(/\.git/, '').match(/.+(@|\/\/)([^/]+)\/(.+)$/)
const repoPublicUrl = `https://${repoHost}/${repoName}`
const repoAuthedUrl = `https://${gitAuth}@${repoHost}/${repoName}`
await $`git config user.name ${gitCommitterName}`
await $`git config user.email ${gitCommitterEmail}`
await $`git remote set-url origin ${repoAuthedUrl}`

// Commits analysis
const semanticTagPattern = /^v?(\d+)\.(\d+)\.(\d+)$/
Expand Down Expand Up @@ -114,9 +111,11 @@ ${commits.join('\n')}`).join('\n')
// Update package.json version
await $`npm --no-git-tag-version version ${nextVersion}`

if (dryRun) {
return
}
if (dryRun) return

await $`git config user.name ${gitCommitterName}`
await $`git config user.email ${gitCommitterEmail}`
await $`git remote set-url origin ${repoAuthedUrl}`

// Prepare git commit and push
// Hint: PAT may be replaced with a SSH deploy token
Expand Down

0 comments on commit 8adcb14

Please sign in to comment.