Created
December 21, 2021 18:35
-
-
Save nioe/9258ec610e58dd62d69f2e1949e43fb0 to your computer and use it in GitHub Desktop.
standard-version configuration file to bump version in gradle projects (build.gradle)
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
const versionRegex = /version = '(\d+\.\d+\.\d+)'/; | |
const gradleFileUpdater = { | |
filename: 'build.gradle', | |
updater: { | |
readVersion: contents => { | |
const match = contents.match(versionRegex); | |
if (match && match[1]) { | |
return match[1]; | |
} | |
throw Error('Could not read version from build.gradle'); | |
}, | |
writeVersion: (contents, version) => contents.replace(versionRegex, `version = '${version}'`) | |
} | |
}; | |
module.exports = { | |
header: '# Changelog', | |
types: [ | |
{ | |
type: 'feat', | |
section: 'π Features' | |
}, | |
{ | |
type: 'fix', | |
section: 'π Bug Fixes' | |
}, | |
{ | |
type: 'ci', | |
section: 'π CI/CD' | |
}, | |
{ | |
type: 'build', | |
section: 'π¦ Build' | |
}, | |
{ | |
type: 'chore', | |
'hidden': true | |
}, | |
{ | |
type: 'docs', | |
section: 'π Documentation' | |
}, | |
{ | |
type: 'style', | |
section: 'π πΌ Style' | |
}, | |
{ | |
type: 'refactor', | |
section: 'π Refactorings' | |
}, | |
{ | |
type: 'perf', | |
'hidden': 'βοΈ Performance' | |
}, | |
{ | |
type: 'test', | |
section: 'β Tests' | |
} | |
], | |
packageFiles: [gradleFileUpdater], | |
bumpFiles: [gradleFileUpdater] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment