Skip to content

Automate versioning for projects using Gradle

License

Notifications You must be signed in to change notification settings

Anvell/versioning-gradle-plugin

Repository files navigation

Versioning Gradle Plugin

Calculate and apply automatic CalVer commits and tags to your project.

Setup

Using the plugins DSL:

plugins {
    id("io.github.anvell.versioning.gradle.plugin") version "2024.06.01"
}

How to use

Basic configuration

configureVersioning {
    // Default is 'origin'
    remote.set("your-remote-name")

    // Set 'true' to push automatically
    autoPush.set(true)

    // Specify version catalog to use
    versionCatalog.set(file("gradle/project.versions.toml"))
}

Create version commit

In order to create new version launch Gradle task:

$ ./gradlew publishVersion

This will increment latest version from version catalog found in VCS history according to CalVer rules, create commit and optionally push it to the remote.

Create version tag

$ ./gradlew publishVersionTag

Plugin will attempt to parse latest tag and increment version according to CalVer rules. Using different variants allows to tag the same version for different environments.

Contributing

Feel free to open a issue or submit a pull request for any bugs/improvements.

Credits

This project uses Kotlin gradle plugin template.