/versioner

Primary LanguageKotlin

Usage

Increase build number (Usually by CI)
curl -X POST localhost:8080/version -H "Content-Type: application/json" -d '{"id": "com.walfud.versioner", "current": "1.2.3", "part": "build", "ret": "major.minor.patch.build-3"}'

# or
curl -X POST localhost:8080/version -H "Content-Type: application/json" -d '{"id": "com.walfud.versioner", "current": "1.2.3.0", "part": "build", "ret": "major.minor.patch.build-3"}'

"1.2.3.001" or "1.2.3.002" or until a build number not taken up by others

Increase patch number
curl -X POST localhost:8080/version -H "Content-Type: application/json" -d '{"id": "com.walfud.versioner", "current": "1.2.3", "part": "patch", "ret": "major.minor.patch"}'

"1.2.3" or "1.2.4" or until a patch number not taken up by others

Parameter

id

One id per application. It's usually be your package name.

current

Current version

part

If the version has taken by others, which part should be increased.

Can only be one of major or minor or patch or build.

ret

Return value your want.

Can be composition of major or minor or patch or build, joined by .(dot character).

Each part can be fixed length by "part-N".

Common usage:

format description return
major.minor.patch return sematic version 1.2.3
major.minor.patch.build return sematic version with build number 1.2.3.4
major.minor.patch.build-3 build part with fixed length 1.2.3.004
API docs

OpenAPI: http://localhost:8080/swagger-ui/index.html?configUrl=%2Fv3%2Fapi-docs%2Fswagger-config

Rule

  • Minimum build number is 1, other is 0. That means the minimum major.minor.patch is "0.0.0", while major.minor.patch.build is "0.0.0.1".
  • Return new version or your version?
    a. If the version does NOT EXIST, your expected version is return.
    b. If the version does EXIST, a new version with increased part is return.

Install & Deploy

docker and docker-compose is required.

git clone https://github.com/walfud/versioner.git
cd ./versioner
docker-compose up -d

server listening on 10000, mysql listening on 10010 and 10011(debug)

TODO

  • actuator & doc