forked from Venly/connect-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
50 lines (50 loc) · 1.71 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pipeline {
agent any
environment {
GITHUB_CREDS = credentials('GITHUB_CRED')
}
options {
disableConcurrentBuilds()
timeout(time: 15, unit: 'MINUTES')
}
stages {
stage ('Bump version (develop)') {
when {
expression {
return env.BRANCH_NAME == 'develop'
}
}
steps {
sh "git config --global user.email \"jenkins@arkane.network\""
sh "git config --global user.name \"Jenkins\""
sh "npm version prerelease --preid=develop"
}
}
stage('Build') {
steps {
sh "npm i"
sh "npm run build-ts"
sh "npm run build-js"
}
}
stage ('Publish (develop)') {
environment {
NPM_KEY = credentials('NPM_KEY')
}
when {
expression {
GIT_BRANCH = env.BRANCH_NAME
return GIT_BRANCH == 'develop'
}
}
steps {
sh "printf '//registry.npmjs.org/:_authToken=' > .npmrc && printf '${NPM_KEY}' >> .npmrc"
sh 'npm publish --tag develop'
withCredentials([usernamePassword(credentialsId: 'GITHUB_CRED', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh 'git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/ArkaneNetwork/arkane-connect.git HEAD:refs/heads/${GIT_BRANCH}'
sh 'git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/ArkaneNetwork/arkane-connect.git --tags'
}
}
}
}
}