Skip to content

Commit

Permalink
Release 1.10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
awps committed Nov 13, 2023
1 parent 939f7bf commit d72c67f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,7 @@ In the above example we replace the version from style.css with the new version

## New in version 1.10.1
* Added Github release prompt. This will allow to create a Github release directly from terminal after the tag is created.

## New in version 1.10.3
* Added `--auto-release` argument to create a Github release directly from terminal after the tag is created (automatically, without confirmation).
* Added `auto-release` option in `package.json` file. This will allow to create a Github release directly from terminal after the tag is created (automatically, without confirmation).
17 changes: 16 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ Options:
return;
}

// abort if multiple args are passed from this list [p, m, major, minor, patch]
// if in array then abort
const multipleArgs = ['p', 'm', 'major', 'minor', 'patch', 'reverse', 'custom', 'info'];
const multipleArgsPassed = multipleArgs.filter(arg => args[arg]);

if (multipleArgsPassed.length > 1) {
await console.log(chalk.red.bold('Too many arguments!'))
return;
}

// read package.json
const pkgPath = path.join(process.cwd(), 'package.json')

if (!fs.existsSync(pkgPath)) {
Expand Down Expand Up @@ -324,14 +335,18 @@ Options:
const ghInstalled = shell.exec(`gh --version`, {silent: true}).stdout;

if (ghInstalled) {
const autoRelease = args['auto-release'] || (pkgContent && pkgContent.tagy && pkgContent.tagy['auto-release']);

const ghRelease = await prompts({
type: 'confirm',
name: 'value',
message: `Do you want to create a release on GitHub?`,
initial: false
})

if (ghRelease.value) {
const releaseIt = autoRelease || ghRelease.value;

if (releaseIt) {
await shell.exec(`gh release create ${tagPrefix}${vv} --title "${tagPrefix}${vv}" --notes "Release ${tagPrefix}${vv}"`)
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tagy",
"version": "1.10.2",
"version": "1.10.3",
"description": "Create a new git tag by following the 'Semantic Versioning' and push it on remote.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d72c67f

Please sign in to comment.