now snapshot versions have more correct name (#195)
This commit is contained in:
4
.github/workflows/publish.yaml
vendored
4
.github/workflows/publish.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Upload to Docker
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: jib -Pdocker=drpcorg -Pbuild_version=${{ github.ref_name }}
|
||||
arguments: jib -Pdocker=drpcorg
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
- name: Build zip
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: distZip -Pbuild_version=${{ github.ref_name }}
|
||||
arguments: distZip
|
||||
- name: Upload Release
|
||||
id: upload-release-asset
|
||||
uses: svenstaro/upload-release-action@v1-release
|
||||
|
||||
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@@ -20,6 +20,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
@@ -32,6 +33,7 @@ jobs:
|
||||
- name: Check
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
arguments: check
|
||||
env:
|
||||
CI: true
|
||||
|
||||
19
build.gradle
19
build.gradle
@@ -36,7 +36,7 @@ group = 'io.emeraldpay.dshackle'
|
||||
// Version schema:
|
||||
// x.x.x for production, following SemVer model
|
||||
// x.x.x-SNAPSHOT for development
|
||||
version = project.hasProperty('build_version') ? project.property('build_version') : "0.0.1-SNAPSHOT"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
@@ -199,6 +199,7 @@ jar {
|
||||
|
||||
afterEvaluate {
|
||||
distZip.dependsOn(jar)
|
||||
generateVersion.dependsOn(getVersion)
|
||||
compileKotlin.dependsOn(generateVersion)
|
||||
jar.dependsOn(generateVersion)
|
||||
}
|
||||
@@ -317,5 +318,17 @@ tasks.withType(Detekt).configureEach {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
// formats code for each build
|
||||
tasks.findByName("ktlintCheck").dependsOn("ktlintFormat")
|
||||
task getVersion {
|
||||
def exactVersion = 'git describe --tags --exact-match'.execute().text.trim()
|
||||
if (exactVersion) {
|
||||
version = exactVersion
|
||||
} else {
|
||||
def tag = 'git describe --tags --abbrev=0'.execute().text.trim()
|
||||
def m = tag =~ /\.(\d+)$/
|
||||
def match = m[0][1]
|
||||
def next = match.toInteger() + 1
|
||||
tag = tag.replaceAll(/.\d+$/, "." + next.toString())
|
||||
version = tag + '-SNAPSHOT'
|
||||
}
|
||||
version = version.replaceAll(/^v/, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user