forked from wireapp/wire-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux.Jenkinsfile
75 lines (61 loc) · 2.59 KB
/
linux.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
@NonCPS
def parseJson(def text) {
new groovy.json.JsonSlurperClassic().parseText(text)
}
node('node180') {
checkout scm
def jenkinsbot_secret = ''
withCredentials([string(credentialsId: "${params.JENKINSBOT_SECRET}", variable: 'JENKINSBOT_SECRET')]) {
jenkinsbot_secret = env.JENKINSBOT_SECRET
}
def text = readFile('info.json')
def buildInfo = parseJson(text)
def version = buildInfo.version + '.' + env.BUILD_NUMBER
currentBuild.displayName = version;
def environment = docker.build("node", "-f linux.Dockerfile .")
environment.inside {
stage('Checkout & Clean') {
git branch: "${GIT_BRANCH}", url: 'https://github.com/wireapp/wire-desktop.git'
sh returnStatus: true, script: 'rm -rf $WORKSPACE/wrap/ $WORKSPACE/electron/node_modules/ $WORKSPACE/node_modules/ $WORKSPACE/*.sig'
}
stage('Build') {
try {
sh 'pip install -r requirements.txt'
sh 'node -v'
sh 'npm -v'
sh 'yarn'
sh 'yarn build:ts'
withCredentials([string(credentialsId: 'RAYGUN_API_KEY', variable: 'RAYGUN_API_KEY')]) {
sh 'npx grunt linux-prod'
}
} catch(e) {
currentBuild.result = 'FAILED'
wireSend secret: "${jenkinsbot_secret}", message: "🐧 **${JOB_NAME} ${version} build failed** see: ${JOB_URL}"
throw e
}
}
stage('Generate repository') {
withCredentials([file(credentialsId: 'D599C1AA126762B1.asc', variable: 'PGP_PRIVATE_KEY_FILE'), string(credentialsId: 'PGP_PASSPHRASE', variable: 'PGP_PASSPHRASE')]) {
sh 'cd wrap/dist/ && ../../bin/repo/linux-prod-repo.sh'
}
}
stage('Create SHA256 checksums') {
withCredentials([file(credentialsId: 'D599C1AA126762B1.asc', variable: 'PGP_PRIVATE_KEY_FILE'), string(credentialsId: 'PGP_PASSPHRASE', variable: 'PGP_PASSPHRASE')]) {
sh "cd wrap/dist/ && ../../bin/linux-checksums.sh ${version}"
}
}
stage('Test packaging') {
sh 'dpkg-deb --info wrap/dist/debian/pool/main/*amd64.deb'
sh 'dpkg-deb --info wrap/dist/debian/pool/main/*i386.deb'
}
stage('Save .deb, .rpm, AppImage and repo files') {
archiveArtifacts 'info.json,wrap/dist/*.deb,wrap/dist/*.rpm,wrap/dist/*.AppImage,wrap/dist/debian/**'
}
stage('Upload build as draft to GitHub') {
withCredentials([string(credentialsId: 'GITHUB_ACCESS_TOKEN', variable: 'GITHUB_ACCESS_TOKEN')]) {
sh 'cd wrap/dist/ && python ../../bin/github_draft.py'
}
}
}
wireSend secret: "${jenkinsbot_secret}", message: "🐧 **New build of ${JOB_NAME} ${version} available for download on** ${JOB_URL}"
}