-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfileRelease
48 lines (41 loc) · 2.53 KB
/
JenkinsfileRelease
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
properties([
gitLabConnection('gitlab')
])
parameters {
string(name: 'SDK_VERSION', defaultValue: 'v2310.0.0', description: 'version of sdk')
}
node('win2019_2') {
try {
stage('checkout'){
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-go.git']]])
}
stage('prepare to release') {
withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
bat 'REM Scripts\\createVersion.bat %SDK_VERSION% %gitUsername% %gitPass%'
}
}
stage('Merge master to release'){
checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-go.git']]])
bat "git config user.email '[email protected]'"
bat "git config user.name 'jenkins'"
bat "git checkout --merge release"
bat "git reset --hard origin/release"
bat "git merge --no-ff --allow-unrelated-histories origin/master"
bat "git diff --name-status"
bat 'git commit -am "Merged master branch to release" || exit 0'
withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
bat "git push https://$gitUsername:[email protected]/words-cloud/words-cloud-go.git release"
}
}
stage('add version tag') {
bat "git config user.email '[email protected]'"
bat "git config user.name 'jenkins'"
bat "git tag -a %SDK_VERSION% -m \"version %SDK_VERSION%\""
withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
bat "git push https://%gitUsername%:%gitPass%@git.auckland.dynabic.com/words-cloud/words-cloud-go.git %SDK_VERSION%"
}
}
} finally {
deleteDir()
}
}