This plugin contains a set of tasks to help with the release process of a Java project in GitHub repository.
You can find out these tasks in the release
group.
Apply this plugin in your build.gradle
file:
plugins {
id 'java'
id 'maven-publish'
id 'com.robothy.github-repository-release-plugin' version '1.1'
}
Add version
property to your ${rootProject}/gradle.properties
file as the first snapshot version of your project:
version=1.0-SNAPSHOT
Now you can update the versions in the ${rootProject}/gradle.properties
file via Gradle tasks.
nextSnapshotVersion
- Update the version ingradle.properties
to the next snapshot version. For example, 1.0-SNAPSHOT -> 1.1-SNAPSHOT, 1.0 -> 1.1-SNAPSHOTreleaseVersion
- Update the version ingradle.properties
number to a release version. For example, 1.0-SNAPSHOT -> 1.0, 1.0 -> 1.0release
- Therelease
task execute these works: 1. update to release version. 2. invokepublish
orpublishPlugins
to publish artifacts. 3. Tag, commit, and push the changes ingradle.properties
to the remote repository. 4. Update the version to the next snapshot version.
You can integrate these tasks in you CI/CD pipeline to automate the release process. One of the best practice of this plugin is this repository itself. It uses GitHub Actions as the CI tool. You can find out the release process in the .github/workflows/release.yml
file.
A snapshot is a version number with a "-SNAPSHOT" suffix. It is a version number that is not yet released. For example, 1.0-SNAPSHOT. On the contrary, a release version is a version number that without
-SNAPSHOT
suffix. For example, 1.0.