-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
55 lines (51 loc) · 1.82 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
pipeline {
agent any
environment {
version = "${env.BRANCH_NAME}-${env.BUILD_ID}"
CONFIG_FILE_ID = "weverify-plugin-${env.BRANCH_NAME}-env"
}
stages {
stage ('Build Plugin') {
agent {
docker {
image 'node:22-alpine'
reuseNode true
}
}
when {
anyOf {
branch 'beta-master';
branch 'pre-master';
branch 'master';
}
}
steps {
slackSend channel: 'medialab_builds', message: "Start build ${env.JOB_NAME} - ID: ${env.BUILD_ID}", tokenCredentialId: 'medialab_slack_token'
configFileProvider([configFile(fileId: CONFIG_FILE_ID, targetLocation: '.env')]){
sh "npm ci"
sh "npm run build"
}
}
}
stage ('Deliver') {
when {
anyOf {
branch 'beta-master';
branch 'pre-master';
branch 'master';
}
}
steps {
zip zipFile: "/var/build/${env.BRANCH_NAME}/we-werify-plugin-${version}-${GIT_COMMIT}.zip", dir: "./build"
}
}
}
post {
success {
slackSend channel: 'medialab_builds', message: "Success build ${env.JOB_NAME} - ID: ${env.BUILD_ID} artefact ready: /var/build/${env.BRANCH_NAME}/we-werify-plugin-${version}-${GIT_COMMIT}.zip", tokenCredentialId: 'medialab_slack_token'
}
failure {
slackSend channel: 'medialab_builds', message: "Error building project ${env.JOB_NAME} - ID: ${env.BUILD_ID}", tokenCredentialId: 'medialab_slack_token'
}
}
}