Skip to content

Commit

Permalink
e Updated gittey config with new aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
cmstead committed Aug 18, 2021
1 parent e09be9f commit f810c43
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gittey-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
{
"name": "push",
"command": "gittey pull; git push"
},
{
"name": "push-minor",
"command": "gittey pull; node ./version-bump minor; git push origin main --tags"
},
{
"name": "push-patch",
"command": "gittey pull; node ./version-bump patch; git push origin main --tags"
}
],
"collaborators": [
Expand Down
34 changes: 34 additions & 0 deletions version-bump.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// npm verison bump broke. This is a quick patch.
const childProcess = require('child_process');
const fs = require('fs');

const packageData = require('./package.json');

const versionTokens = packageData.version.split('.').map(value => parseInt(value, 10));

const [rawVersionType] = process.argv.slice(2);

const versionType = rawVersionType.toLowerCase();

if (versionType === 'patch') {
versionTokens[2]++;
} else if (versionType === 'minor') {
versionTokens[1]++;
versionTokens[2] = 0;
} else if (versionType === 'major') {
versionTokens[0]++;
versionTokens[1] = 0;
versionTokens[2] = 0;
}

const versionString = versionTokens.join('.');

packageData.version = versionString;

fs.writeFileSync(
'./package.json',
JSON.stringify(packageData, null, 4),
{ encoding: 'utf8' });

childProcess.execSync(`git commit -am "New version, ${versionString}"`);
childProcess.execSync(`git tag v${versionString}`);

0 comments on commit f810c43

Please sign in to comment.