diff --git a/package.json b/package.json index c815272..1d6cb34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clear-wallet", - "version": "1.4.10", + "version": "1.4.11", "private": true, "description": "Clear Wallet (CLW) is a wallet that helps you manage your Ethereum assets and interact with Ethereum dApps and contracts with the main focus on absolute privacy.", "type": "module", diff --git a/release-scripts/version-release.ts b/release-scripts/version-release.ts index be3c49b..4fac62b 100644 --- a/release-scripts/version-release.ts +++ b/release-scripts/version-release.ts @@ -5,25 +5,29 @@ import { resolve } from 'path'; async function main() { // 0. Check tag is not already created const tags = execSync(`git tag --list`).toString(); - if (tags.includes(`v${process.env.npm_package_version}`)) { - console.log(`Tag v${process.env.npm_package_version} already exists`); + if(!process.env.npm_package_version) { + console.log('No version found in package.json'); + return; + } + + const nextVersion = bumpVersion(process.env.npm_package_version); + if (tags.includes(`v${nextVersion}`)) { + console.log(`Tag v${nextVersion} already exists`); return; } // 1. Bump version in package.json const packageJsonPath = resolve('./package.json'); const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); - const currentVersion = packageJson.version; - const newVersion = bumpVersion(currentVersion); - packageJson.version = newVersion; + packageJson.version = nextVersion; writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); // 3. Commit changes execSync(`git add .`); - execSync(`git commit -m "clear-wallet@v${newVersion}"`); + execSync(`git commit -m "clear-wallet@v${nextVersion}"`); // 4. Create and push tag - execSync(`git tag v${newVersion}`); + execSync(`git tag v${nextVersion}`); execSync(`git push --follow-tags`); }