Skip to content

Commit

Permalink
chore(release): 0.2.1-alpha.5
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Oct 2, 2024
1 parent 0172eb7 commit 22704b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "github:CartoDB/carto-api-client",
"author": "Don McCurdy <[email protected]>",
"packageManager": "[email protected]",
"version": "0.2.1-alpha.4",
"version": "0.2.1-alpha.5",
"license": "MIT",
"publishConfig": {
"access": "public",
Expand Down
8 changes: 7 additions & 1 deletion scripts/postversion-commit.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import {execSync} from 'node:child_process';
import {readFile} from 'node:fs/promises';
import {resolve} from 'node:path';
import {valid} from 'semver';

/**
* Utility for committing and tagging a release commit in
* git, called as part of the `yarn postversion` script.
*/

const {version} = await import('../package.json', {assert: {type: 'json'}});
// Read and validate pkg.version.
const pkgJSON = await readFile(resolve('./package.json'), 'utf-8');
const {version} = JSON.parse(pkgJSON);
if (!valid(version)) {
throw new Error(`Invalid version, "${version}"`);
}

// Check out a branch if cutting a version from 'main'.
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
if (branch === 'main') {
execSync(`git checkout -b 'release/${version}'`);
}

// Commit and tag.
execSync('git add -u');
execSync(`git commit -m 'chore(release): ${version}'`);
execSync(`git tag -a ${version} -m ${version}`);

0 comments on commit 22704b2

Please sign in to comment.