-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile
89 lines (77 loc) · 2.37 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2020, 2023 Oracle and/or its affiliates.
pipeline {
options {
disableConcurrentBuilds()
}
agent {
docker {
image "${RUNNER_DOCKER_IMAGE}"
args "${RUNNER_DOCKER_ARGS}"
registryUrl "${RUNNER_DOCKER_REGISTRY_URL}"
registryCredentialsId 'ocir-pull-and-push-account'
label "pipeline-job-single-large"
}
}
parameters {
booleanParam (name: 'PUBLISH_TO_GH_PAGES',
defaultValue: false,
description: 'When true, builds the production website and pushes to the gh-pages branch')
}
environment {
GIT_AUTH = credentials('github-packages-credentials-rw')
EMAIL = credentials('github-packages-email')
}
stages {
stage('Setup Dependencies') {
steps {
sh """
npm install
"""
}
}
stage('Build staging documentation') {
steps {
sh """
mkdir -p staging
hugo --source . --destination staging --environment staging
"""
}
}
stage('Build production documentation') {
steps {
sh """
mkdir -p production
env HUGO_ENV=production hugo --source . --destination production --environment production
"""
}
}
stage('Publish documentation to gh-pages') {
when {
anyOf {
branch 'master'
equals expected: true, actual: params.PUBLISH_TO_GH_PAGES
}
}
steps {
sh """
echo "run site publisher"
./scripts/publish.sh "${env.BRANCH_NAME}"
"""
}
}
stage('Creating production documentation zip') {
steps {
sh """
zip -r verrazzano-production-docs.zip production
"""
}
}
stage('Archive artifacts ') {
steps {
archiveArtifacts artifacts: 'staging/**'
archiveArtifacts artifacts: 'production/**'
archiveArtifacts artifacts: 'verrazzano-production-docs.zip'
}
}
}
}