From 3d2a29116dc5dcc29862b8701d3be6e23cfe3a17 Mon Sep 17 00:00:00 2001 From: rschoene <rene.schoene@tu-dresden.de> Date: Thu, 14 Jan 2021 16:29:28 +0100 Subject: [PATCH] Activate publishing using CI. --- .gitignore | 1 + .gitlab-ci.yml | 11 +++++++++- ragconnect.base/build.gradle | 42 ++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 78aba4b..9d11133 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .idea/ .gradle/ build/ +/gradle.properties diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae70e04..97c262a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ variables: stages: - build +- publish - deploy before_script: @@ -14,7 +15,7 @@ cache: - .gradle/caches build: - image: openjdk:8 + image: openjdk:11 stage: build script: - ./gradlew --console=plain --no-daemon assemble jar @@ -22,6 +23,14 @@ build: paths: - "/builds/jastadd/ragconnect/build/libs/ragconnect-*.jar" +publish: + image: openjdk:11 + stage: publish + script: + - "./gradlew publish" +# only: +# - master + pages: image: python:3.7-alpine stage: deploy diff --git a/ragconnect.base/build.gradle b/ragconnect.base/build.gradle index 153a3be..e03dfa4 100644 --- a/ragconnect.base/build.gradle +++ b/ragconnect.base/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'java-library' apply plugin: 'idea' apply plugin: 'jastadd' apply plugin: 'application' +apply plugin: 'maven-publish' group = 'de.tudresden.inf.st' @@ -178,3 +179,44 @@ jastadd { } generateAst.dependsOn relast + +//708 +publishing { + publications { + maven(MavenPublication) { + artifactId = 'ragconnect' + from components.java +// artifact("build/libs/ragconnect-${version}.jar") { +// extension 'jar' +// } + } + } + repositories { +// maven { +// name 'nexus' +// url "http://172.22.1.152:8081/repository/" + (project.hasProperty('asSnapshot') ? "maven-snapshots" : "maven-releases/") +// credentials { +// username project.ext.properties.repoUser +// password project.ext.properties.repoPassword +// } +// } + maven { + url "https://git-st.inf.tu-dresden.de/api/v4/projects/708/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