/
Jenkinsfile
47 lines (46 loc) · 1.06 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
pipeline {
agent {
docker {
image 'taskbjorn/hexo'
}
}
stages {
stage('检出') {
steps {
checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]], userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]])
}
}
stage('环境') {
steps {
echo '构建中...'
sh 'npm config set registry http://mirrors.cloud.tencent.com/npm/'
sh 'npm install'
sh 'hexo -v'
echo '构建完成.'
}
}
stage('生产') {
steps {
echo '生产中...'
sh 'hexo clean'
sh 'hexo g'
echo '生产完成.'
}
}
stage('部署') {
steps {
echo '部署中...'
dir(path: 'public') {
sh 'ls'
sh 'git init'
sh 'git config user.name $USER_NAME'
sh 'git config user.email $USER_EMAIL'
sh 'git add -A'
sh 'git commit -m \'init\''
sh 'git push -u -f "$USER_PROJECT" master:master'
}
echo '部署完成'
}
}
}
}