Update Jenkinsfile, deliver.sh, and 2 more files...

This commit is contained in:
Andrea Cavalli 2020-10-03 12:00:11 +02:00
parent 4b83967b7a
commit 277b7f1275
4 changed files with 151 additions and 68 deletions

49
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env groovy
// see https://jenkins.io/doc/book/pipeline/syntax/
pipeline {
environment {
MVN_SET = credentials('maven_settings')
}
agent { docker { image 'maven:3.6.3' } }
triggers {
pollSCM "* * * * *"
}
options {
timestamps()
ansiColor("xterm")
}
parameters {
booleanParam(name: "RELEASE",
description: "Build a release from current commit.",
defaultValue: false)
}
stages {
stage("Build & Deploy SNAPSHOT") {
steps {
sh "mvn -s $MVN_SET -B deploy"
}
}
stage("Release") {
when {
expression { params.RELEASE }
}
steps {
sh "mvn -s $MVN_SET -B release:prepare"
sh "mvn -s $MVN_SET -B release:perform"
}
}
stage('Deliver') {
steps {
sh './jenkins/scripts/deliver.sh'
}
}
}
post {
always {
deleteDir()
}
}
}

3
jenkins/scripts/deliver.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
echo "Delivered."

145
pom.xml
View File

@ -1,70 +1,79 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-windows-amd64</artifactId>
<version>1.1.20</version>
<name>TDLight Natives for Windows (amd64)</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>publish-to-mchv</id>
<properties/>
<distributionManagement>
<repository>
<id>mchv</id>
<name>MCHV Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv/</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>publish-to-github</id>
<properties/>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub TDLight Team Apache Maven Packages</name>
<url>https://maven.pkg.github.com/tdlight-team/tdlight-java</url>
</repository>
</distributionManagement>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-windows-amd64</artifactId>
<version>2.0.1-SNAPSHOT</version>
<name>TDLight Natives for Windows (amd64)</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>mchv</id>
<name>MCHV Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv/</url>
</repository>
<snapshotRepository>
<id>mchv</id>
<name>MCHV Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot/</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:git:git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-windows-amd64.git</connection>
<url>scm:git:git@github.com:user/project.git</url>
<developerConnection>scm:git:git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-windows-amd64.git</developerConnection>
<tag>master</tag>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>perform</goal>
</goals>
<configuration>
<pomFileName>${project.name}/pom.xml</pomFileName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
</project>

22
seedjob.groovy Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env groovy
// see https://jenkinsci.github.io/job-dsl-plugin/ and https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob
pipelineJob("my-maven-lib") {
displayName("My Maven Lib")
definition {
cpsScm {
scm {
git {
remote {
url("...")
branch("*/master")
}
extensions {
localBranch("master")
}
}
}
scriptPath("Jenkinsfile")
}
}
}