-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
54 lines (53 loc) · 2.08 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
pipeline {
agent any
stages {
stage('Unit tests') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
sh '''
rm -f TestResults*.xml
install-unity run ${WORKSPACE} -- -batchmode -runTests -testPlatform playmode -testCategory UnitTest
'''
}
nunit testResultsPattern: 'TestResults*.xml'
}
}
stage('Android build') {
steps {
withCredentials([file(credentialsId: 'VIKKEKEYSTORE', variable: 'VIKKEKS'), string(credentialsId: 'VIKKEKSPW', variable: 'VIKKEKSPW'), string(credentialsId: 'VIKKEKEY', variable: 'VIKKEKEY')]) {
sh 'install-unity run ${WORKSPACE} -- -batchmode -executeMethod JenkinsBuild.BuildAndroid ${WORKSPACE} --keystore ${VIKKEKS} --storepass ${VIKKEKSPW} --keypass ${VIKKEKEY} --keyalias vikkeupload -quit -logFile ${WORKSPACE}/BuildLog_Android_${BUILD_ID}.xml'
}
dir('Android') {
archiveArtifacts 'VIKKE.aab'
}
}
}
stage('Generate Xcode project') {
steps {
sh 'install-unity run ${WORKSPACE} -- -batchmode -executeMethod JenkinsBuild.BuildiOS ${WORKSPACE} -quit -logFile ${WORKSPACE}/BuildLog_iOS_${BUILD_ID}.xml'
}
}
stage('Build iOS app') {
steps {
sh '''
cd ${WORKSPACE}/iOS
xcodebuild -project Unity-iPhone.xcodeproj -scheme Unity-iPhone -sdk iphoneos -configuration Release clean -allowProvisioningUpdates
xcodebuild -project Unity-iPhone.xcodeproj -scheme Unity-iPhone -sdk iphoneos -archivePath ${JOB_NAME}.xcarchive -configuration Release archive -allowProvisioningUpdates
'''
withCredentials([file(credentialsId: 'EXPORTPLIST', variable: 'EXPORTPLIST')]) {
sh 'xcodebuild -exportArchive -archivePath ${WORKSPACE}/iOS/${JOB_NAME}.xcarchive -exportOptionsPlist ${EXPORTPLIST} -exportPath ${WORKSPACE}/iOS/ -allowProvisioningUpdates'
}
dir('iOS') {
archiveArtifacts 'Unity-iPhone.ipa'
}
}
}
stage('Upload iOS app') {
steps {
withCredentials([string(credentialsId: 'ALTOOLPW', variable: 'ALTOOLPW')]) {
sh 'xcrun altool --upload-app -f ${WORKSPACE}/iOS/Unity-iPhone.ipa -u ${APPLEID} -p ${ALTOOLPW}'
}
}
}
}
}