From 6b11cce4423ec1adc7caa9ecf9b808a31abde170 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Wed, 14 Oct 2020 22:38:47 +0200 Subject: [PATCH] Update Jenkinsfile and pom.xml --- Jenkinsfile | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 49 ++++++++++++++++++++++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..7b91615 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,70 @@ +#!/usr/bin/env groovy +// see https://jenkins.io/doc/book/pipeline/syntax/ + +pipeline { + environment { + MVN_SET = credentials('maven_settings') + JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven' + } + agent any + options { + timestamps() + ansiColor("xterm") + } + parameters { + booleanParam(name: "RELEASE", + description: "Build a release from current commit.", + defaultValue: false) + } + stages { + stage("Setup workspace") { + agent none + steps { + sh "mkdir -p \"/var/jenkins_cache/.m2\"" + sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\"" + sh "mkdir -p \"/var/jenkins_cache/.ccache\"" + sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\"" + } + } + + stage("Build & Deploy SNAPSHOT") { + agent { + docker { + image 'maven:3.6.3-openjdk-11' + args '-v $HOME:/var/maven' + reuseNode true + } + } + steps { + sh "mvn -s $MVN_SET -B deploy" + } + } + + stage("Release") { + agent { + docker { + image 'maven:3.6.3-openjdk-11' + args '-v $HOME:/var/maven' + reuseNode true + } + } + when { + expression { params.RELEASE } + } + steps { + sh "git config user.email \"jenkins@mchv.eu\"" + sh "git config user.name \"Jenkins\"" + sh "cd ${workspace}" + sh "git add --all || true" + sh "git commit -m \"Add generated files\" || true" + sh "mvn -B -s $MVN_SET -Drevision=${BUILD_NUMBER} clean deploy" + } + } + } + post { + always { + /* clean up directory */ + deleteDir() + } + } +} diff --git a/pom.xml b/pom.xml index d06be31..6f33cd2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,10 +4,11 @@ 4.0.0 it.tdlight tdlib-session-container - 3.169.54 + 4.0.${revision} TDLib Session Container UTF-8 + 0-SNAPSHOT 11 11 @@ -29,6 +30,23 @@ https://mvn.mchv.eu/repository/mchv-snapshot + + + mchv-release-distribution + MCHV Release Apache Maven Packages Distribution + https://mvn.mchv.eu/repository/mchv + + + mchv-snapshot-distribution + MCHV Snapshot Apache Maven Packages Distribution + https://mvn.mchv.eu/repository/mchv-snapshot + + + + scm:git:https://git.ignuranza.net/tdlight-team/tdlib-session-container.git + scm:git:https://git.ignuranza.net/tdlight-team/tdlib-session-container.git + HEAD + io.vertx @@ -173,6 +191,35 @@ 11 + + maven-deploy-plugin + 2.8.2 + + + org.codehaus.mojo + flatten-maven-plugin + 1.1.0 + + true + resolveCiFriendliesOnly + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + org.codehaus.mojo templating-maven-plugin