@@ -11,22 +11,21 @@ pipeline {
1111 }
1212 }
1313 environment {
14- DEPLOY_URL = " https://strongbox.github.io"
14+ DEPLOY_URL = " https://strongbox.github.io"
1515 }
1616 options {
1717 timeout(time : 30 , unit : ' MINUTES' )
18+ disableConcurrentBuilds()
1819 }
1920 stages {
20- stage(' Node' )
21- {
21+ stage(' Node' ) {
2222 steps {
2323 container(" mkdocs" ) {
2424 nodeInfo(" python pip mkdocs" )
2525 }
2626 }
2727 }
28- stage(' Building' )
29- {
28+ stage(' Building' ) {
3029 steps {
3130 container(" mkdocs" ) {
3231 withCredentials([string(credentialsId : ' 3ea1e18a-b1d1-44e0-a1ff-7b62870913f8' , variable : ' GOOGLE_ANALYTICS_KEY' )]) {
@@ -37,19 +36,43 @@ pipeline {
3736 }
3837 stage(' Deploying' ) {
3938 when {
40- expression { BRANCH_NAME == ' master' && (currentBuild. result == null || currentBuild. result == ' SUCCESS' ) }
39+ expression {
40+ BRANCH_NAME == ' master' && (currentBuild. result == null || currentBuild. result == ' SUCCESS' )
41+ }
4142 }
4243 steps {
4344 container(" mkdocs" ) {
44- configFileProvider([configFile(fileId : ' e0235d92-c2fc-4f81-ae4b-28943ed7350d' , targetLocation : ' /tmp/gh-pages.sh' )]) {
45- withCredentials([sshUserPrivateKey(credentialsId : ' 011f2a7d-2c94-48f5-92b9-c07fd817b4be' , keyFileVariable : ' SSH_KEY' , usernameVariable : ' SSH_USER' )]) {
46- withEnv([" GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o User=${ SSH_USER} -i ${ SSH_KEY} " ]) {
47- sh " /bin/bash /tmp/gh-pages.sh"
48- }
45+ withCredentials([sshUserPrivateKey(credentialsId : ' 011f2a7d-2c94-48f5-92b9-c07fd817b4be' , keyFileVariable : ' SSH_KEY' , usernameVariable : ' SSH_USER' )]) {
46+ withEnv([" GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o User=${ SSH_USER} -i ${ SSH_KEY} " ]) {
47+ sh ' git checkout --orphan gh-pages'
48+ sh ' find . -maxdepth 1 ! -name "site" ! -name ".git*" ! -name "." -exec git rm -rf {} \\ ;'
49+ sh ' git add --force site'
50+ sh ' git commit -m "Updating documentation site."'
51+ sh ' git remote add strongbox.github.io git@github.com:strongbox/strongbox.github.io.git'
52+ sh ' git push strongbox.github.io `git subtree split --prefix site gh-pages`:master --force'
4953 }
5054 }
5155 }
5256 }
5357 }
5458 }
59+ post {
60+ failure {
61+ script {
62+ if (params. NOTIFY_EMAIL )
63+ {
64+ notifyFailed((BRANCH_NAME == " master" ) ? notifyMaster : notifyBranch)
65+ }
66+ }
67+ }
68+ fixed {
69+ script {
70+ if (params. NOTIFY_EMAIL )
71+ {
72+ notifyFixed((BRANCH_NAME == " master" ) ? notifyMaster : notifyBranch)
73+ }
74+ }
75+ }
76+ }
5577}
78+
0 commit comments