Skip to content

Commit

Permalink
Fixing deploy stage
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-todorov committed Sep 29, 2019
1 parent 7815b23 commit 62da7c0
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@ pipeline {
}
}
environment {
DEPLOY_URL="https://strongbox.github.io"
DEPLOY_URL = "https://strongbox.github.io"
}
options {
timeout(time: 30, unit: 'MINUTES')
disableConcurrentBuilds()
}
stages {
stage('Node')
{
stage('Node') {
steps {
container("mkdocs") {
nodeInfo("python pip mkdocs")
}
}
}
stage('Building')
{
stage('Building') {
steps {
container("mkdocs") {
withCredentials([string(credentialsId: '3ea1e18a-b1d1-44e0-a1ff-7b62870913f8', variable: 'GOOGLE_ANALYTICS_KEY')]) {
Expand All @@ -37,19 +36,43 @@ pipeline {
}
stage('Deploying') {
when {
expression { BRANCH_NAME == 'master' && (currentBuild.result == null || currentBuild.result == 'SUCCESS') }
expression {
BRANCH_NAME == 'master' && (currentBuild.result == null || currentBuild.result == 'SUCCESS')
}
}
steps {
container("mkdocs") {
configFileProvider([configFile(fileId: 'e0235d92-c2fc-4f81-ae4b-28943ed7350d', targetLocation: '/tmp/gh-pages.sh')]) {
withCredentials([sshUserPrivateKey(credentialsId: '011f2a7d-2c94-48f5-92b9-c07fd817b4be', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
withEnv(["GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o User=${SSH_USER} -i ${SSH_KEY}"]) {
sh "/bin/bash /tmp/gh-pages.sh"
}
withCredentials([sshUserPrivateKey(credentialsId: '011f2a7d-2c94-48f5-92b9-c07fd817b4be', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
withEnv(["GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o User=${SSH_USER} -i ${SSH_KEY}"]) {
sh 'git checkout --orphan gh-pages'
sh 'find . -maxdepth 1 ! -name "site" ! -name ".git*" ! -name "." -exec git rm -rf {} \\;'
sh 'git add --force site'
sh 'git commit -m "Updating documentation site."'
sh 'git remote add strongbox.github.io [email protected]:strongbox/strongbox.github.io.git'
sh 'git push strongbox.github.io `git subtree split --prefix site gh-pages`:master --force'
}
}
}
}
}
}
post {
failure {
script {
if (params.NOTIFY_EMAIL)
{
notifyFailed((BRANCH_NAME == "master") ? notifyMaster : notifyBranch)
}
}
}
fixed {
script {
if (params.NOTIFY_EMAIL)
{
notifyFixed((BRANCH_NAME == "master") ? notifyMaster : notifyBranch)
}
}
}
}
}

0 comments on commit 62da7c0

Please sign in to comment.