-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93c894f
commit 0d197a0
Showing
2 changed files
with
10 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
import {execSync} from 'node:child_process'; | ||
import pkg from '../package.json' assert {type: 'json'}; | ||
|
||
/** | ||
* Utility for committing and tagging a release commit in | ||
* git, called as part of the `yarn postversion` script. | ||
*/ | ||
|
||
const currentBranch = execSync('git rev-parse --abbrev-ref HEAD') | ||
.toString() | ||
.trim(); | ||
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim(); | ||
const {version} = require('../package.json'); | ||
|
||
if (currentBranch === 'main') { | ||
execSync(`git checkout -b 'release/${pkg.version}'`); | ||
if (branch === 'main') { | ||
execSync(`git checkout -b 'release/${version}'`); | ||
} | ||
|
||
execSync('git add -u'); | ||
execSync(`git commit -m 'chore(release): ${pkg.version}'`); | ||
execSync(`git tag -a ${pkg.version} -m ${pkg.version}`); | ||
execSync(`git commit -m 'chore(release): ${version}'`); | ||
execSync(`git tag -a ${version} -m ${version}`); |