Use version from git for building and publishing
Gitea/Java-Installer/pipeline/head This commit looks good Details

snapshot v1.1.1
Jonas Letzbor 2023-12-28 22:51:43 +01:00
parent 31dcd1ebe8
commit 3e289e756a
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
3 changed files with 19 additions and 2 deletions

16
Jenkinsfile vendored
View File

@ -18,6 +18,22 @@ pipeline {
// Only test to build the installer when we are not on the master branch
sh 'gradle --no-build-cache build'
} else {
// Get the version to release
def version = sh (
script: 'git describe --tags --abbrev=0',
returnStdout: true
).replace("\n", "")
if (version == null || version.allWhitespace) {
error("Commit is not tagged with a version")
}
def versionV = version.replaceFirst("v", "")
// Write the version into the version file
sh "echo ${versionV} > VERSION"
echo "Building and publishing version ${versionV}"
// Build and publish
withCredentials([
file(credentialsId: 'MAVEN_PUBLISH_SONATYPE_GRADLE_PROPERTIES', variable: 'SONATYPE_CREDENTIALS')
]) {

1
VERSION 100644
View File

@ -0,0 +1 @@
0.0.0

View File

@ -8,8 +8,8 @@ plugins {
// Set version of programm //
version = "1.1.0"
def version = "1.1.0"
version = project.file("./VERSION").text.trim()
def version = project.file("./VERSION").text.trim()
group = "de.rpjosh"