This repository has been archived by the owner on Apr 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
67 lines (60 loc) · 2.27 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
stage("Build") {
parallel (
"Windows" : {
node('windows') {
checkout poll: false, changelog: false, scm: scm
bat 'git submodule update --init'
bat 'powershell.exe -ExecutionPolicy Bypass .\\Build.ps1'
stash includes: 'dist/**', name: 'windows'
archiveArtifacts 'dist/**'
}
},
"macOS" : {
node('mac') {
checkout poll: false, changelog: false, scm: scm
sh 'git submodule update --init'
sh './build.mac.sh'
stash includes: 'dist/**', name: 'mac'
archiveArtifacts 'dist/**'
}
},
"Linux" : {
node('linux') {
checkout scm
sh 'git submodule update --init'
sh './build.linux.sh'
stash includes: 'dist/**', name: 'linux'
archiveArtifacts 'dist/**'
}
}
)
}
if (env.BRANCH_NAME == 'master') {
stage('Publish') {
node('linux') {
unstash 'windows'
unstash 'mac'
unstash 'linux'
withCredentials([string(credentialsId: 'HiveMP-Deploy', variable: 'GITHUB_TOKEN')]) {
sh("""
#!/bin/bash
set -e
echo "Creating SDK package..."
cd dist/
tar -czvf ../HiveMP.ClientConnect-SDK.tar.gz sdk
cd ..
echo "test" > test.txt
echo "Testing upload of new version works to ensure GitHub API is responding..."
\$GITHUB_RELEASE upload --user HiveMP --repo HiveMP.ClientConnect --tag latest --name TestUpload --file test.txt
echo "Deleting release from GitHub before creating a new one..."
\$GITHUB_RELEASE delete --user HiveMP --repo HiveMP.ClientConnect --tag latest || true
echo "Creating a new release on GitHub..."
\$GITHUB_RELEASE release --user HiveMP --repo HiveMP.ClientConnect --tag latest --name "Latest Release (Build \$BUILD_ID)" --description "This is an automatic release created by the build server. The HiveMP.ClientConnect-SDK.tar.gz package contains pre-built binaries for all supported platforms."
echo "Uploading SDK to GitHub..."
\$GITHUB_RELEASE upload --user HiveMP --repo HiveMP.ClientConnect --tag latest --name HiveMP.ClientConnect-SDK.tar.gz --file HiveMP.ClientConnect-SDK.tar.gz
echo "Done!"
""")
}
}
}
}