-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
35 lines (35 loc) · 1.11 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
node {
nvm('v16.20.0') {
stage('Prepare environment') {
cleanWs()
git branch: 'development', url: 'https://github.com/luomus/laji.git'
sh 'npm ci'
sh 'mkdir test-results'
sh 'rm -rf test-results/*'
currentBuild.result = 'SUCCESS'
}
stage('Build') {
if (currentBuild.result == 'SUCCESS' || currentBuild.result == 'UNSTABLE') {
milestone()
sh 'rm -rf dist'
sh 'npm run --silent build:dev'
sh 'pre-compress-web-assets dist/browser'
}
}
stage('Archive') {
if (currentBuild.result == 'SUCCESS' || currentBuild.result == 'UNSTABLE') {
sh 'tar -cvzf dist.tar.gz --strip-components=1 dist'
archive 'dist.tar.gz'
}
}
stage('Deploy staging') {
if (currentBuild.result == 'SUCCESS' || currentBuild.result == 'UNSTABLE') {
milestone()
sh 'scp -r dist node@192.168.10.57:/data/dev_laji_fi/'
slackSend(color: 'good', message: "dev.laji.fi - #$BUILD_NUMBER Success")
} else {
slackSend(color: 'danger', message: "dev.laji.fi - #$BUILD_NUMBER Failed")
}
}
}
}