forked from jenkins-x/jx-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
56 lines (51 loc) · 1.46 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
pipeline {
agent any
environment {
HUGO_ENV = "production"
HUGO_VERSION = "0.26"
BUILD_NUMBER = "$BUILD_NUMBER"
GH_CREDS = credentials('jx-pipeline-git-github-github')
GHE_CREDS = credentials('jx-pipeline-git-github-ghe')
GIT_USERNAME = "$GH_CREDS_USR"
GIT_API_TOKEN = "$GH_CREDS_PSW"
GITHUB_ACCESS_TOKEN = "$GH_CREDS_PSW"
JOB_NAME = "$JOB_NAME"
BRANCH_NAME = "$BRANCH_NAME"
}
stages {
stage('CI Validate') {
when {
branch 'PR-*'
}
steps {
sh "git clone https://github.com/jenkins-x/jx-docs.git"
dir("jx-docs") {
sh "git fetch origin pull/$PULL_NUMBER/head:$BRANCH_NAME"
sh "git checkout $PULL_PULL_SHA"
sh "hugo version"
sh "hugo -d tmp-website --enableGitInfo"
}
}
}
stage('Regenerate Website') {
when {
branch 'master'
}
steps {
sh "git clone https://github.com/jenkins-x/jx-docs.git"
dir("jx-docs") {
sh "git clone https://github.com/jenkins-x/jenkins-x-website.git"
sh "hugo version"
sh "hugo -d jenkins-x-website --enableGitInfo"
dir("jenkins-x-website") {
sh "jx step git credentials"
sh 'git config credential.helper store'
sh 'git add *'
sh "git commit --allow-empty -a -m \"updated site\""
sh "git push origin"
}
}
}
}
}
}