-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
26 lines (25 loc) · 985 Bytes
/
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
pipeline {
agent {
node {
label 'jenkins-master'
}
}
stages {
stage('publish') {
steps{
sh "git config --global user.email \"[email protected]\""
sh "git config --global user.name \"jiangxiaoqiang\""
withCredentials([usernamePassword(credentialsId: 'github-credential', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
script {
env.encodedPass=URLEncoder.encode(PASS, "UTF-8")
}
sh 'git checkout master'
sh 'git pull origin master'
sh 'git add .'
sh "git diff-index --quiet HEAD || git commit -m \"[docs] scheduled auto commit task\" || git push"
sh "git push https://${USER}:${encodedPass}@github.com/jiangxiaoqiang/jiangxiaoqiang.github.io.git"
}
}
}
}
}