@@ -3,17 +3,16 @@ properties properties: [
33 [$class : ' GithubProjectProperty' , displayName : ' ' , projectUrlStr : ' https://github.com/TobiasHennig/nativescript-toast/' ],
44]
55
6+ @Library (' mare-build-library' )
7+ def nodeJS = new de.mare.ci.jenkins.NodeJS ()
8+ def git = new de.mare.ci.jenkins.Git ()
9+
610node(' nativescript' ) {
7- def buildNumber = env. BUILD_NUMBER
8- def mvnHome = ' /opt/dev/apache-maven-3.3.1'
11+
912 def workspace = env. WORKSPACE
10- def buildUrl = env. BUILD_URL
11- env. PATH = " ${ env.JAVA_HOME} /bin:${ mvnHome} /bin:${ env.PATH} "
1213
1314 // PRINT ENVIRONMENT TO JOB
1415 echo " workspace directory is $workspace "
15- echo " build URL is $buildUrl "
16- echo " build Number is $buildNumber "
1716 echo " PATH is $env . PATH "
1817
1918 try {
@@ -22,29 +21,27 @@ node('nativescript') {
2221 }
2322
2423 stage(' Build' ) {
25- sh " npm run clean"
26- sh " npm install"
24+ nodeJS. nvmRun(' clean' )
2725 }
2826
2927 stage(' Test' ) {
30- sh " npm run test"
28+ nodeJS . nvmRun( ' test' )
3129 junit ' test/android/build/reports/TEST-*.xml'
3230 }
3331
3432 stage(' E2E' ) {
35- sh " npm run pre-e2e"
36- sh " npm run e2e"
33+ nodeJS. nvmRun(' e2e' )
3734 junit ' tmp/TEST-*.xml'
3835 }
3936
40- stage( ' Publish NPM snapshot ' ) {
41- def currentVersion = sh( returnStdout : true , script : " npm version | grep \" { \" | tr -s ':' | cut -d \" ' \" -f 4 " ) . trim()
42- def newVersion = " ${ currentVersion } - ${ buildNumber } "
43- sh " npm version ${ newVersion } --no-git-tag-version && npm publish --tag next "
37+ if (git . isDevelopBranch() || git . isFeatureBranch()) {
38+ stage( ' Publish NPM snapshot ' ) {
39+ nodeJS . publishSnapshot( ' . ' , env . BUILD_NUMBER , env . BRANCH_NAME )
40+ }
4441 }
4542
4643 } catch (e) {
4744 mail
subject :
" ${ env.JOB_NAME} (${ env.BUILD_NUMBER} ): Error on build" ,
to :
' [email protected] ' ,
body :
" Please go to ${ env.BUILD_URL} ." 4845 throw e
4946 }
50- }
47+ }
0 commit comments