-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsFile
58 lines (54 loc) · 1.65 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
pipeline {
agent any
tools { nodejs "Node 20" }
options {
buildDiscarder(logRotator(artifactNumToKeepStr: "5"))
copyArtifactPermission('/*-Myneworm');
}
stages {
stage('Prepare') {
environment {
projVersion = sh(script: 'npm pkg get version | sed "s/^.//g" | sed "s/.$//"', , returnStdout: true).trim()
gitRevision = '${GIT_REVISION,length=6}'
buildCount = '${BUILD_NUMBER}'
}
steps {
buildName "${projVersion}.${buildCount}.${gitRevision}"
sh 'npm install'
}
}
stage('Test') {
steps {
sh 'npm run eslint'
}
}
stage ('Build: Stable') {
when { branch 'stable' }
steps {
sh 'npm run build:prod'
}
}
stage ('Build: Staging') {
when { branch 'development' }
steps {
sh 'npm run build:stage'
}
}
stage('Build: Development') {
when {
expression { BRANCH_NAME != /(stable|development)/ }
}
steps {
sh 'npm run build:test'
}
}
stage('Create Artifact') {
steps {
script {
zip zipFile: "myneworm-built-${BUILD_NUMBER}.zip", archive: false, dir: 'dist/Myneworm'
}
archiveArtifacts artifacts: "myneworm-built-${BUILD_NUMBER}.zip", fingerprint: true, followSymlinks: false, onlyIfSuccessful: true
}
}
}
}