This repository was archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathJenkinsfile
More file actions
64 lines (62 loc) · 1.43 KB
/
Jenkinsfile
File metadata and controls
64 lines (62 loc) · 1.43 KB
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
pipeline {
agent {
docker { image 'kkarczmarczyk/node-yarn' }
}
stages {
stage('Pull') {
when {
branch 'master'
}
steps {
git(url: 'https://github.com/HiDIKI/hidiki.github.io.build.git', branch: 'master', poll: true)
}
}
stage('Test') {
when {
branch 'master'
}
steps {
sh 'node --version'
sh 'yarn --version'
}
}
stage('Build') {
when {
branch 'master'
}
steps {
sh 'set -e'
sh 'yarn'
sh 'yarn build'
sh 'cp ./google*.html ./docs'
}
}
stage('Deploy') {
when {
branch 'master'
}
environment {
GITHUB_CRED = credentials('github-cred')
}
steps {
dir('docs') {
sh 'git init'
sh 'git remote add origin https://$GITHUB_CRED_USR:$GITHUB_CRED_PSW@github.com/HiDIKI/hidiki.github.io.git'
sh 'git config user.name hidekuma'
sh 'git config user.email d.hidekuma@gmail.com'
sh 'git add -A'
sh 'git commit -m "DEPLOY"'
sh 'git push -f --set-upstream origin master'
}
}
}
}
post {
success {
slackSend (color: '#00FF00', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
}
failure {
slackSend (color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
}
}
}