forked from dynatrace-oss/barista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (76 loc) · 2.1 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
pipeline {
agent {
node {
label 'default'
}
}
parameters {
gitParameter(
branch: '',
branchFilter: 'origin/([0-9]{1,}\\.x|[0-9]{1,}\\.[0-9]{1,}\\.x|master)',
defaultValue: 'master',
description: 'The branch you want to release from',
name: 'BRANCH',
quickFilterEnabled: false,
selectedValue: 'NONE',
sortMode: 'NONE',
tagFilter: '*',
type: 'PT_BRANCH'
)
}
options {
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('Checkout specified branch') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: "${params.BRANCH}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[
$class: 'LocalBranch',
localBranch: "${params.BRANCH}"
]],
gitTool: 'Default',
submoduleCfg: [],
userRemoteConfigs: [[
url: 'https://github.com/dynatrace-oss/barista.git'
]]
])
}
}
stage('Install dependencies') {
steps {
nodejs(nodeJSInstallationName: 'Node 12.x') {
ansiColor('xterm') {
sh 'npm ci'
}
}
}
}
stage('Publish') {
steps {
withCredentials([
string(credentialsId: 'artifactory-url', variable: 'ARTIFACTORY_URL'),
string(credentialsId: 'circle-ci-token', variable: 'CIRCLE_CI_TOKEN'),
usernamePassword(credentialsId: 'npm-artifactory', passwordVariable: 'NPM_INTERNAL_PASSWORD', usernameVariable: 'NPM_INTERNAL_USER'),
usernamePassword(credentialsId: 'npmjs-dynatrace-nodejs-token', passwordVariable: 'NPM_PUBLISH_TOKEN', usernameVariable: 'NPM_USER'),
usernamePassword(credentialsId: 'dt-ci-github', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')
]) {
nodejs(nodeJSInstallationName: 'Node 12.x') {
sh '''
npm run publish-release
'''
}
}
}
}
}
post {
always {
cleanWs()
}
}
}