Merge pull request #3 from kemitix/jenkins
jenkins: build/deploy with jenkins
This commit is contained in:
commit
0ca9675a55
5 changed files with 39 additions and 13 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
||||||
[submodule ".travis-support"]
|
|
||||||
path = .travis-support
|
|
||||||
url = https://github.com/kemitix/kemitix-travis-support.git
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit b97def251b784ecc8de6d3cc30d2793ac0bd375e
|
|
|
@ -6,10 +6,3 @@ cache:
|
||||||
- "$HOME/.m2"
|
- "$HOME/.m2"
|
||||||
install: true
|
install: true
|
||||||
script: "./mvnw --batch-mode --errors --update-snapshots clean install"
|
script: "./mvnw --batch-mode --errors --update-snapshots clean install"
|
||||||
deploy:
|
|
||||||
provider: script
|
|
||||||
script: sh .travis-support/deploy.sh
|
|
||||||
on:
|
|
||||||
branch: master
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
|
|
39
Jenkinsfile.groovy
Normal file
39
Jenkinsfile.groovy
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
final String mvn = "mvn --batch-mode --update-snapshots"
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage('no SNAPSHOT in master') {
|
||||||
|
// checks that the pom version is not a snapshot when the current branch is master
|
||||||
|
// TODO: also check for SNAPSHOT when is a pull request with master as the target branch
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
(env.GIT_BRANCH == 'master') &&
|
||||||
|
(readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
error("Build failed because SNAPSHOT version")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
|
||||||
|
sh 'mvn clean install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Archiving') {
|
||||||
|
steps {
|
||||||
|
archiveArtifacts '**/classes/**/*.xml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy') {
|
||||||
|
when { expression { (env.GIT_BRANCH == 'master') } }
|
||||||
|
steps {
|
||||||
|
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
|
||||||
|
sh "${mvn} deploy --activate-profiles release -DskipTests=true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,7 @@
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|
Loading…
Reference in a new issue