forked from dlrg/landestool_old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
37 lines (36 loc) · 967 Bytes
/
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
pipeline {
agent {
node {
label 'docker-agent'
}
}
stages {
stage('npm install') {
steps {
sh 'npm i'
}
}
stage('build') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
sh 'npm run build'
sh '''docker build -t codeanker/dlrg-landestool:$(echo ${BRANCH_NAME} | sed "s/\\//-/g") .'''
} else {
sh 'npm run build'
sh '''docker build -t codeanker/dlrg-landestool:$(echo ${BRANCH_NAME} | sed "s/\\//-/g") .'''
}
}
}
}
stage('deploy') {
steps {
archiveArtifacts 'dist/**/*'
withCredentials([usernamePassword(credentialsId: 'docker', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh 'docker login -u $USERNAME -p $PASSWORD'
sh '''docker push codeanker/dlrg-landestool:$(echo ${BRANCH_NAME} | sed "s/\\//-/g")'''
}
}
}
}
}