-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathJenkinsfile
53 lines (45 loc) · 2.11 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
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/hypery2k/Jenkins2Go']
]
node('xcode') {
// Jenkins makes these variables available for each job it runs
def packageName = "com.jenkins2go"
def buildNumber = env.BUILD_NUMBER
def workspace = env.WORKSPACE
def appHome = 'app'
def buildUrl = env.BUILD_URL
def appName = 'Jenkins2Go'
def scheme = 'Jenkins2Go'
def buildSDK = 'iphoneos10.3' // see `xcodebuild -showsdks`
def provisioningProfile = 'Distribution - Jenkins2Go'
// PRINT ENVIRONMENT TO JOB
echo "workspace directory is $workspace"
echo "build URL is $buildUrl"
echo "build Number is $buildNumber"
try {
stage('Checkout') {
// checkout scm
git 'https://github.com/hypery2k/Jenkins2Go.git'
sh 'git submodule init && git submodule update'
sh 'rm -rf target/*'
}
stage('Build') {
sh "agvtool new-version -all ${buildNumber}"
sh "xcodebuild clean build -sdk ${buildSDK} PROVISIONING_PROFILE=\"${provisioningProfile}\" -configuration Release"
}
stage('Test') {
}
stage('Package') {
sh "mkdir -p target"
sh "xcodebuild clean build -scheme \"${scheme}\" -sdk \"${buildSDK}\" -archivePath \"target/${scheme}.xcarchive\" -configuration Release PROVISIONING_PROFILE=\"${provisioningProfile}\" archive "
sh "xcodebuild -exportArchive -sdk \"${buildSDK}\" -archivePath target/${scheme}.xcarchive/ -exportPath \"./target/${scheme}_${buildNumber}.ipa\""
}
stage('Upload App') {
sh "fastlane pilot upload --ipa target/${scheme}_${buildNumber}.ipa"
}
} catch (e) {
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: 'jenkins2go-app@martinreinhardt-online.de', body: "Please go to ${env.BUILD_URL}."
throw e
}
}