1- node('billing-qa-ubuntu-16.04.4 ') {
1+ node('words-linux ') {
22 try {
33 stage('checkout'){
4- checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9d6c4dfa-042c-4ed1-81c7-9175179dddda', url: 'https://github.com/aspose-words-cloud/aspose-words-cloud-node.git/']]])
5- withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'AppKey', usernameVariable: 'AppSid')]) {
6- sh 'echo "{\\"AppSid\\": \\"$AppSid\\",\\"AppKey\\": \\"$AppKey\\", \\"BaseUrl\\": \\"https://auckland-words-cloud-staging.dynabic.com\\"}" > testConfig.json'
7- }
4+ checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-node.git']]])
85
9- sh "git config user.email \"
[email protected] \""
10- sh "git config user.name \"jenkins\""
6+ sh "git config user.email \"
[email protected] \""
7+ sh "git config user.name \"jenkins\""
8+
9+ withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', usernameVariable: 'gitUsername', passwordVariable: 'gitPass')]) {
10+ gitRepoUrl = "https://${gitUsername}:${gitPass}@git.auckland.dynabic.com/words-cloud/words-cloud-node.git"
11+ }
1112 }
1213
1314 docker.image('node:latest').inside{
@@ -37,10 +38,7 @@ node('billing-qa-ubuntu-16.04.4') {
3738 sh "git merge --no-ff --allow-unrelated-histories origin/master"
3839 sh "git diff --name-status"
3940 sh 'git commit -am "Merged master branch to testPackage" || exit 0'
40-
41- withCredentials([usernamePassword(credentialsId: '9d6c4dfa-042c-4ed1-81c7-9175179dddda', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
42- sh "git push https://WordsCloud:
[email protected] /aspose-words-cloud/aspose-words-cloud-node testPackage"
43- }
41+ sh "git push ${gitRepoUrl} testPackage"
4442 }
4543
4644 stage('add reference to new package'){
@@ -64,9 +62,7 @@ node('billing-qa-ubuntu-16.04.4') {
6462 sh "git ls-files --others --exclude-standard"
6563 sh "git add -A"
6664 sh 'git commit -am "new version of package added to repository" || exit 0'
67- withCredentials([usernamePassword(credentialsId: '9d6c4dfa-042c-4ed1-81c7-9175179dddda', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
68- sh "git push https://WordsCloud:
[email protected] /aspose-words-cloud/aspose-words-cloud-node testPackage"
69- }
65+ sh "git push ${gitRepoUrl} testPackage"
7066 }
7167
7268 } finally {
@@ -75,10 +71,9 @@ node('billing-qa-ubuntu-16.04.4') {
7571}
7672
7773stage('test package'){
78- build job: 'words-sdk-nodejs ',
74+ build job: 'words-node-sdk ',
7975 parameters: [
80- string(name: 'branch', value: 'testPackage'),
81- string(name: 'testServerUrl', value: 'https://api.aspose.cloud')
76+ string(name: 'branch', value: 'testPackage')
8277 ]
8378}
8479
@@ -88,11 +83,18 @@ stage('wait for publish confirmation'){
8883 }
8984}
9085
91- node('billing-qa-ubuntu-16.04.4 ') {
86+ node('words-linux ') {
9287 try {
9388 stage('checkout again'){
94- checkout([$class: 'GitSCM', branches: [[name: '*/testPackage']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9d6c4dfa-042c-4ed1-81c7-9175179dddda ', url: 'https://github. com/aspose- words-cloud/aspose- words-cloud-node.git/ ']]])
89+ checkout([$class: 'GitSCM', branches: [[name: '*/testPackage']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547 ', url: 'https://git.auckland.dynabic. com/words-cloud/words-cloud-node.git']]])
9590
91+ sh "git config user.email \"
[email protected] \""
92+ sh "git config user.name \"jenkins\""
93+
94+ withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', usernameVariable: 'gitUsername', passwordVariable: 'gitPass')]) {
95+ gitRepoUrl = "https://${gitUsername}:${gitPass}@git.auckland.dynabic.com/words-cloud/words-cloud-node.git"
96+ }
97+
9698 sh "git checkout testPackage"
9799 sh "git reset --hard origin/testPackage"
98100 }
@@ -108,8 +110,8 @@ node('billing-qa-ubuntu-16.04.4') {
108110 */
109111 'HOME=.',
110112 ]) {
111- withCredentials([usernamePassword (credentialsId: '19f0eab9-c600-4746-a4bd-724efd2102c8', passwordVariable : 'npmPass', usernameVariable: 'npmLogin ')]) {
112- sh "echo //registry.npmjs.org/:_authToken=${npmPass } > .npmrc"
113+ withCredentials([string (credentialsId: '19f0eab9-c600-4746-a4bd-724efd2102c8', variable : 'npmToken ')]) {
114+ sh "echo //registry.npmjs.org/:_authToken=${npmToken } > .npmrc"
113115 sh "npm publish ${packageName}"
114116 }
115117 }
@@ -134,20 +136,18 @@ node('billing-qa-ubuntu-16.04.4') {
134136
135137 sh "git diff --name-status"
136138 sh 'git commit -am "reference changed to published package" || exit 0'
137- withCredentials([usernamePassword(credentialsId: '9d6c4dfa-042c-4ed1-81c7-9175179dddda', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
138- sh "git push https://WordsCloud:
[email protected] /aspose-words-cloud/aspose-words-cloud-node testPackage"
139- }
139+ sh "git push ${gitRepoUrl} testPackage"
140+ }
141+
142+ stage('add version tag') {
143+ final fullVersion = packageName.substring(packageName.lastIndexOf('@') + 1, packageName.length())
144+ final version = fullVersion.substring(0, fullVersion.lastIndexOf('.'))
145+
146+ sh "git tag -a ${version} -m \"version ${version}\""
147+ sh "git push ${gitRepoUrl} ${version}"
140148 }
141149
142150 } finally {
143151 deleteDir()
144152 }
145- }
146-
147- stage('test published package'){
148- build job: 'words-sdk-nodejs',
149- parameters: [
150- string(name: 'branch', value: 'testPackage'),
151- string(name: 'testServerUrl', value: 'https://api.aspose.cloud')
152- ]
153- }
153+ }
0 commit comments