Skip to content

tomtom-international/updatechangelog-gradle-plugin

updatechangelog-gradle-plugin

Gradle plugin for automating the changelog update process.

This plugin creates a task updateChangelog that can be hooked for example into the Gradle release plugin and update a changelog file based on the released version and the release date.

How to use it

  1. Create a changelog file

    echo "# Changelog" > CHANGELOG.md
  2. Add a new bullet point below the header:

    # Changelog
      * Initial commit
  3. Add the Gradle plugin

    1. Using the plugins DSL:

    In build.gradle.kts

    plugins {
        id("com.tomtom.gradle.updatechangelog") version "<version>"
    }

    In build.gradle

    plugins {
      id "com.tomtom.gradle.updatechangelog" version "<version>"
    }
  4. Configure it in build.gradle

    changelog {
      versionPlaceholder = '# Changelog'
      changelogFilename = 'CHANGELOG.md'
    }
  5. Run the updateChangelog task

    This step is just needed to validate that the update task is working as expected. Once you run it you should revert the changes it did in your changelog file.

    ./gradlew updateChangelog

    This command will update the CHANGELOG.md file with the version provided by the project version property and the current date.

    # Changelog
    
    **1.0.0** (2018-10-23):
      * Initial commit
  6. In most cases you will hook this plugin under the Gradle release plugin so that the changelog gets updated whenever a new release is done.

    preTagCommit.dependsOn updateChangelog

How to compile and run tests

Run a clean build:

./gradlew clean build

This command will clean your workspace, build the code and tests and run the unit and functional tests.

To run only tests use the following command:

./gradlew check