Last active
March 28, 2023 20:09
-
-
Save nioe/3346bc5000fc90657cc0895f3a29ee69 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 gradleFile = 'build.gradle'; | |
const gradleFileUpdater = { | |
filename: gradleFile, | |
updater: { | |
readVersion: contents => { | |
const match = contents.match(versionRegex); | |
if (match && match[1]) { | |
return match[1]; | |
} | |
throw Error(`Could not read version from ${gradleFile}`); | |
}, | |
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', | |
section: 'βοΈ 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
Usage
standard-version
according to their documentation