Skip to content

all4-dev/gradle-release-plugin

Repository files navigation

Gradle Release Plugin

Gradle Plugin Portal License

A complete release toolkit: version bumping, changelog generation, git tagging, GitHub releases, and multi-destination publishing.

Quick Start

plugins {
  id("dev.all4.release") version "0.1.0"
}

releaseConfig {
  github("owner/repo")

  pom {
    name.set("My Library")
    license { apache2() }
    developer("dev", "Developer", "dev@example.com")
  }

  destinations {
    mavenLocal.enabled.set(true)
    mavenCentral.enabled.set(true)
  }
}

Tasks

# Version management
./gradlew bumpVersion --bump=patch   # 1.0.0 → 1.0.1
./gradlew bumpVersion --bump=minor   # 1.0.0 → 1.1.0
./gradlew bumpVersion --bump=major   # 1.0.0 → 2.0.0

# Release (bump + tag + GitHub release)
./gradlew createRelease --bump=patch
./gradlew createRelease --version=1.0.0

# Changelog
./gradlew generateChangelog --since=v0.9.0

# Import external artifacts
./gradlew importArtifact --file=legacy.jar --group=com.example --name=legacy

Features

Feature Description
Version bumping Semantic versioning (patch/minor/major)
Git tagging Automatic tag creation and push
GitHub releases Create releases via API with auto-generated notes
Changelog generation Generate from git commits
Multi-destination Maven Local, Central, GitHub Packages/Pages, Plugin Portal
Library groups Publish multiple modules together
Changelog modes Centralized or per-project changelogs
Dry-run mode Preview before publishing
External artifacts Import legacy JARs/AARs
🔐 1Password integration Automatic secret resolution with 1Password CLI

Changelog Configuration

Configure how changelogs are managed per library group:

releaseConfig {
  libraryGroups {
    register("core") {
      modules.add(":core")
      
      // Option 1: Centralized changelog (default)
      changelogMode.set(ChangelogMode.CENTRALIZED)
      changelogPath.set("changelogs/core/CHANGELOG.md")
      
      // Option 2: Per-project changelog (each module has its own)
      changelogMode.set(ChangelogMode.PER_PROJECT)
      // Creates CHANGELOG.md in each module's directory
      
      // Disable changelog generation entirely
      changelogEnabled.set(false)
    }
  }
}
Mode Description
CENTRALIZED Single changelog at configured path (default)
PER_PROJECT Each module maintains its own CHANGELOG.md

Publishing to Maven Central

1. Setup credentials

# ~/.gradle/gradle.properties
sonatypeUsername=your-token-username
sonatypePassword=your-token-password

# GPG signing
signing.gnupg.keyName=YOUR_KEY_ID
signing.gnupg.passphrase=your-passphrase

2. Publish

./gradlew publishToMavenCentral

Documentation

License

Apache 2.0 — see LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors