forked from tutao/tutanota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
160 lines (150 loc) · 4.18 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
pipeline {
environment {
NODE_PATH = "/opt/node-v10.11.0-linux-x64/bin"
}
options {
preserveStashes()
}
parameters {
booleanParam(name: 'RELEASE', defaultValue: false, description: '')
}
agent {
label 'master'
}
stages {
stage('Build Webapp') {
environment {
PATH="${env.PATH}:${env.NODE_PATH}"
}
agent {
label 'linux'
}
steps {
sh 'npm ci'
sh 'node dist release'
stash includes: 'build/dist/**', excludes:'**/index.html, **/app.html, **/desktop.html, **/index.js, **/app.js, **/desktop.js', name: 'web_base'
stash includes: '**/dist/index.html, **/dist/index.js, **/dist/app.html, **/dist/app.js', name: 'web_add'
stash includes: 'build/bundles.json', name: 'bundles'
}
}
stage('Build Desktop clients'){
parallel {
stage('desktop-win') {
environment {
PATH="${env.PATH}:${env.NODE_PATH}"
}
agent {
label 'win'
}
steps {
sh 'npm ci'
sh 'rm -rf ./build/*'
unstash 'web_base'
unstash 'bundles'
withCredentials([string(credentialsId: 'WIN_CSC_KEY_PASSWORD', variable: 'PW')]){
sh '''
export JENKINS=TRUE;
export WIN_CSC_KEY_PASSWORD=${PW};
export WIN_CSC_LINK="/opt/etc/comodo-codesign.p12";
node dist -ew '''
}
dir('build') {
stash includes: 'desktop-test/*', name:'win_installer_test'
stash includes: 'desktop/*', name:'win_installer'
}
}
}
stage('desktop-mac') {
agent {
label 'mac'
}
steps {
sh 'npm ci'
sh 'rm -rf ./build/*'
unstash 'web_base'
unstash 'bundles'
withCredentials([string(credentialsId: 'WIN_CSC_KEY_PASSWORD', variable: 'PW')]){
sh '''
export JENKINS=TRUE;
export MAC_CSC_KEY_PASSWORD=${PW};
export MAC_CSC_LINK="/opt/etc/comodo-codesign.p12";
node dist -em '''
}
dir('build') {
stash includes: 'desktop-test/*', name:'mac_installer_test'
stash includes: 'desktop/*', name:'mac_installer'
}
}
}
stage('desktop-linux'){
agent {
label 'linux'
}
environment {
PATH="${env.PATH}:${env.NODE_PATH}"
}
steps {
sh 'npm ci'
sh 'rm -rf ./build/*'
unstash 'web_base'
unstash 'bundles'
withCredentials([string(credentialsId: 'WIN_CSC_KEY_PASSWORD', variable: 'PW')]){
sh '''
export JENKINS=TRUE;
export LINUX_CSC_KEY_PASSWORD=${PW};
export LINUX_CSC_LINK="/opt/etc/comodo-codesign.p12";
node dist -el '''
}
dir('build') {
stash includes: 'desktop-test/*', name:'linux_installer_test'
stash includes: 'desktop/*', name:'linux_installer'
}
}
}
}
}
stage('Copy Snapshot'){
agent {
label 'master'
}
when {
expression { !params.RELEASE }
}
steps {
sh 'rm -rf /opt/desktop-snapshot/*'
dir('/opt/desktop-snapshot/') {
unstash 'linux_installer_test'
unstash 'win_installer_test'
unstash 'mac_installer_test'
}
}
}
stage('Build deb and publish') {
when {
expression { params.RELEASE }
}
agent {
label 'linux'
}
environment {
PATH="${env.PATH}:${env.NODE_PATH}"
}
steps {
sh 'npm ci'
sh 'rm -rf ./build/*'
unstash 'web_base'
unstash 'web_add'
unstash 'bundles'
dir('build'){
unstash 'linux_installer'
unstash 'mac_installer'
unstash 'win_installer'
unstash 'linux_installer_test'
unstash 'mac_installer_test'
unstash 'win_installer_test'
}
sh 'node dist -edp release'
}
}
}
}