Update Jenkinsfile and pom.xml

This commit is contained in:
Andrea Cavalli 2020-10-14 22:38:47 +02:00
parent 4fe963c3b7
commit 6b11cce442
2 changed files with 118 additions and 1 deletions

70
Jenkinsfile vendored Normal file
View File

@ -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()
}
}
}

49
pom.xml
View File

@ -4,10 +4,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>tdlib-session-container</artifactId>
<version>3.169.54</version>
<version>4.0.${revision}</version>
<name>TDLib Session Container</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0-SNAPSHOT</revision>
<!-- required for jdk9 -->
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
@ -29,6 +30,23 @@
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>mchv-release-distribution</id>
<name>MCHV Release Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
<snapshotRepository>
<id>mchv-snapshot-distribution</id>
<name>MCHV Snapshot Apache Maven Packages Distribution</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:git:https://git.ignuranza.net/tdlight-team/tdlib-session-container.git</connection>
<developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlib-session-container.git</developerConnection>
<tag>HEAD</tag>
</scm>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
@ -173,6 +191,35 @@
<target>11</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>