Skip to content
Automated release management for Gradle project
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test test: reproduce problem by jest Mar 22, 2019
.gitignore
.nvmrc
.travis.yml
CHANGELOG.md chore(release): 1.0.3 [skip ci] Mar 29, 2019
LICENSE
README.md
package.json chore(release): 1.0.3 [skip ci] Mar 29, 2019
tsconfig.json
tslint.json chore(build): introduce tslint-config-prettier to avoid config conflict Mar 26, 2019
yarn.lock

README.md

A semantic-release plugin for Gradle project

Yet another gradle-semantic-release-plugin that invokes Gradle wrapper script to release.

Build Status npm Commitizen friendly semantic-release

Precondition

To apply this semantic-release plugin, you need to fulfill the following preconditions:

  1. Your Gradle project should manage its version by gradle.properties (not by build.gradle nor build.gradle.kts).
  2. Your Gradle project should have an executable Gradle wrapper script at the project root directory.
  3. Your CI environment should run on Linux environment that can run ./gradlew.
  4. Your Gradle project should use Maven Publish Plugin or Legacy publishing to publish artifact.

Installation

Install semantic-release

Follow install guide and CI configuration guide described in the semantic-release official document.

To manage version of toolset, we recommend you to have a package.json in your project root directory. Manage both of semantic-release and its plugins as devDependencies.

It is also nice to have "semantic-release": "semantic-release" in "scripts" in package.json, then you can run yarn semantic-release to invoke semantic-release.

Refer this sample project as a working example.

Configure @semantic-release/git

This plugin updates gradle.properties to bump up project version, so it is recommended to let @semantic-release/git commits this file to Git. To realize this operation, you can configure your package.json like below:

  "release": {
    "plugins": [
      "gradle-semantic-release-plugin",
      [
        "@semantic-release/git",
        {
          "assets": [
            "gradle.properties"
          ]
        }
      ]
    ]
  },

Configure your CI

If your CI configuration is for java app development, then you may need to install node and yarn by your own. For Travis CI, it has nvm in the PATH so you can install them like below:

language: java
before_install: # or at the release stage described in the following part
  - nvm install 8
  - yarn install # or "npm ci"

Then trigger semantic-release at the release stage. For now the build stage is recommended over the travis-deploy-once:

jobs:
  include:
    - stage: release
      script: skip
      deploy:
        provider: script
        skip_cleanup: true
        script:
          - yarn semantic-release # or "npm run semantic-release"

FAQ

How it's different with the @tschulte/gradle-semantic-release-plugin?

That is a Gradle plugin implemented by Java. It can use Gradle's feature and ecosystem. However, it emulates semantic-release and cannot use other semantic-release plugin at the same time.

Our plugin is a semantic-release plugin. It can work with other plugin implemented on node.js, but it just invokes Gradle and cannot handle so complex requirements by own.

Copyright

Copyright (c) 2019 Kengo TODA

You can’t perform that action at this time.