From e8d381bbe71db5f3d0dc243a850e94a8c23d74a8 Mon Sep 17 00:00:00 2001 From: rschoene <rene.schoene@tu-dresden.de> Date: Wed, 4 Aug 2021 11:14:50 +0200 Subject: [PATCH] publish jar --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++++++++ build.gradle | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..30459db7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +stages: + - build + - publish + +before_script: + - export GRADLE_USER_HOME=`pwd`/.gradle + +cache: + paths: + - .gradle/wrapper + - .gradle/caches + +build: + image: openjdk:8 + stage: build + script: + - ./gradlew --console=plain --no-daemon assemble jar + artifacts: + paths: + - "jastadd2.jar" + expire_in: 1 week + +publish: + image: openjdk:8 + stage: publish + needs: + - test + script: + - "./gradlew publish" + only: + - dev + - master diff --git a/build.gradle b/build.gradle index 53744c44..5c6ed585 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,8 @@ apply plugin: 'java' apply plugin: 'application' apply plugin: 'maven' apply plugin: 'signing' +apply plugin: 'maven-publish' + defaultTasks 'jar' @@ -406,3 +408,36 @@ if (project.hasProperty('ossrhUsername')) { } } } + +version = fullVersion + "-dresden" +//187 +publishing { + publications { + maven(MavenPublication) { + // artifactId = 'ragconnect' + artifact("jastadd2.jar") { + extension 'jar' + } + } + } + repositories { + maven { + url "https://git-st.inf.tu-dresden.de/api/v4/projects/187/packages/maven" + // Uncomment the following lines to publish manually (and comment out the other credentials section) +// credentials(HttpHeaderCredentials) { +// name = "Private-Token" +// value = gitLabPrivateToken // the variable resides in ~/.gradle/gradle.properties +// } + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = System.getenv("CI_JOB_TOKEN") + } + authentication { + header(HttpHeaderAuthentication) + } + } + + } +} + +publish.dependsOn jar -- GitLab