This Gradle plugin allows you to manage and manipulate versioning for your project. It provides tasks to print,
initialize, increment and promote versions by using a .properties file.
In some use cases the automation using a CI/CD can be painful to write especially when you want to make it fit
with your versioning strategy.
-
Print Version Task
- Task:
PrintVersionTask - Description: Prints the current version read from the version properties file.
- Task:
-
Initialize Version Task
- Task:
InitializeVersionTask - Description: Initializes the version properties file if it doesn't exist.
- Task:
-
Increment Version Task
- Task:
IncrementVersionTask - Description: Increments the version based on the specified type (major, minor, patch).
- Task:
-
Promote Version Task
- Task:
PromoteVersionTask - Description: Promotes the version when it is considered as stable by removing the version suffix parts.
- Task:
To use the plugin, configure it in your build.gradle.kts:
plugins {
id("com.n-apos.version") version "x.y.z"
}
semanticVersion {
// Configure path to your version properties file (Optional)
path = "${project.projectDir}/version.properties"
}- Print Version
./gradlew printVersion- Initialize Version
./gradlew initializeVersion- Increment Version
./gradlew incrementVersion --type=<MINOR|MAJOR|PATCH|SUFFIX|SUFFIX_INCREMENT>- Promote Version
When the version of the project contains a suffix, for examplealpha01, beta02, etc, the promoteVersion task
allows to remove the suffix in order to promote when it is considered as stable.
./gradlew promoteVersion