forked from CleverCloud/clever-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
42 lines (41 loc) · 1.04 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
pipeline {
agent { label 'cc-ci-agent' }
environment {
GIT_TAG_NAME = gitTagName()
S3_KEY_ID = credentials('CELLAR_CC_COMPONENTS_ACCESS_KEY_ID')
S3_SECRET_KEY = credentials('CELLAR_CC_COMPONENTS_SECRET_ACCESS_KEY')
}
options {
buildDiscarder(logRotator(daysToKeepStr: '5', numToKeepStr: '10', artifactDaysToKeepStr: '5', artifactNumToKeepStr: '10'))
}
stages {
stage('build') {
when {
not {
environment name: 'GIT_TAG_NAME', value: ''
}
beforeAgent true
}
steps {
sh 'npm install'
sh 'npm run components:build-cdn'
sh 'npm run components:build-cdn:versions-list'
}
}
stage('publish') {
when {
not {
environment name: 'GIT_TAG_NAME', value: ''
}
beforeAgent true
}
steps {
sh 'npm run components:publish-cdn'
}
}
}
}
@NonCPS
String gitTagName() {
return sh(script: 'git describe --tags --exact-match $(git rev-parse HEAD) || true', returnStdout: true)?.trim()
}