Skip to content

Commit

Permalink
Update Jenkinsfile (#270)
Browse files Browse the repository at this point in the history
update Jenkins
  • Loading branch information
saiemmani authored May 3, 2021
1 parent 3ea96ce commit 29c77d7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
12 changes: 10 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,16 @@ options { disableConcurrentBuilds() }
stage('Build') {
steps {
echo 'Building project...'
sh "./mvnw install source:jar-no-fork -Prelease,ossrh -U -s settings.xml"
}
withCredentials([file(credentialsId: 'gpg-private-key', variable: 'GPG_KEY')]) {
sh "gpg2 --no-tty --import $GPG_KEY || /bin/true"
withPullRequestBranch {
sh "./mvnw install source:jar-no-fork -Prelease -U -s settings.xml"
}
withMasterBranch {
sh "./mvnw deploy source:jar-no-fork -Prelease -U -s settings.xml"
}
}
}
}

stage('SonarQube') {
Expand Down
6 changes: 6 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sonar.host.url=https://sonar.appdirect.tools
sonar.projectKey=service-integration-sdk
sonar.projectName=service-integration-sdk
sonar.sources=src/main
sonar.java.binaries=target/classes
sonar.java.libraries=target/*.jar
12 changes: 8 additions & 4 deletions src/script/addkeys.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash

sed '/<\/settings>/{
r src/script/settings
a \</settings>
sed '/<\/profiles>/{
r src/script/profiles
a \</profiles>
d
}' mavenSettings | sed -e "s/GPG_PASSPHRASE/$GPG_PASSPHRASE/" -e "s/OSSRH_USERNAME/$OSSRH_USERNAME/" -e "s/OSSRH_PASSWORD/$OSSRH_PASSWORD/" > settings.xml
}' mavenSettings |sed '/<\/servers>/{
r src/script/servers
a \</servers>
d
}' | sed -e "s/GPG_PASSPHRASE/$GPG_PASSPHRASE/" -e "s/OSSRH_USERNAME/$OSSRH_USERNAME/" -e "s/OSSRH_PASSWORD/$OSSRH_PASSWORD/" > settings.xml
10 changes: 10 additions & 0 deletions src/script/profiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg2</gpg.executable>
<gpg.passphrase>GPG_PASSPHRASE</gpg.passphrase>
</properties>
</profile>
5 changes: 5 additions & 0 deletions src/script/servers
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<server>
<id>ossrh</id>
<username>OSSRH_USERNAME</username>
<password>OSSRH_PASSWORD</password>
</server>
21 changes: 0 additions & 21 deletions src/script/settings

This file was deleted.

0 comments on commit 29c77d7

Please sign in to comment.