-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpackage_jenkins.groovy
80 lines (72 loc) · 3.04 KB
/
package_jenkins.groovy
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
pipeline {
agent {
docker {
label 'linux_fleet'
image 'linux_gowrappers:latest'
registryUrl 'https://448036597521.dkr.ecr.us-east-1.amazonaws.com'
registryCredentialsId 'ecr:us-east-1:Jenkins'
alwaysPull true
}
}
parameters {
string(defaultValue: '', description: 'What version to pull from for packaging.', name: 'VERSION')
string(defaultValue: '', description: 'What name to give the created branch.', name: 'RELEASE_NAME')
booleanParam(defaultValue: false, description: 'Set to true if you wish to push the build to git.', name: 'SHOULD_PUSH')
}
stages {
stage('Build') {
steps {
s3ArtifactCopyInvoke('PDFNetWrappers Go/' + params.VERSION.replace("/", "%2F"), 'PDFTronGoLinux.zip')
s3ArtifactCopyInvoke('PDFNetWrappers Go Windows/' + params.VERSION.replace("/", "%2F"), 'PDFTronGoWin.zip')
s3ArtifactCopyInvoke('PDNetWrappers Go Mac/' + params.VERSION.replace("/", "%2F"), 'PDFTronGoMac.zip')
s3ArtifactCopyInvoke('PDFNetWrappers Mac Arm/' + params.VERSION.replace("/", "%2F"), 'PDFTronGoMacArm.zip')
unzip zipFile: 'PDFTronGoLinux.zip'
unzip zipFile: 'PDFTronGoWin.zip'
unzip zipFile: 'PDFTronGoMac.zip'
unzip zipFile: 'PDFTronGoMacArm.zip'
sh 'rm -rf PDFTronGo*.zip'
zip zipFile: 'PDFTronGo.zip', overwrite: true
s3ArtifactUpload('PDFTronGo.zip')
}
}
stage('Push') {
when {
expression {
return params.SHOULD_PUSH
}
}
steps {
sshagent(['jenkins/xodo-shared-ssh-key']) {
sh """
git checkout -b ${params.RELEASE_NAME}
git add README.md
git add pdftron_linux.go
git add pdftron_windows.go
git add pdftron_darwin_arm64.go
git add pdftron_darwin_x86_64.go
git add shared_libs/mac/Lib/arm64/libPDFNetC.dylib
git add shared_libs/mac/Lib/arm64/libpdftron.dylib
git add shared_libs/mac/Lib/x86_64/libPDFNetC.dylib
git add shared_libs/mac/Lib/x86_64/libpdftron.dylib
git add shared_libs/unix/Lib/libPDFNetC.so
git add shared_libs/unix/Lib/libpdftron.so
git add shared_libs/win/Lib/pdftron.dll
git add shared_libs/win/Lib/PDFNetC.dll
git add samples/*
git add go.mod
git commit -m "Update for ${params.VERSION} release."
git push origin ${params.RELEASE_NAME}
"""
}
}
}
}
post {
failure {
sendMail([
currentBuild: currentBuild,
env: env
])
}
}
}