Skip to content

Instantly share code, notes, and snippets.

@cemayan
Created May 12, 2021 16:09
Show Gist options
  • Save cemayan/98aab831abe91522826c3d6d1195571d to your computer and use it in GitHub Desktop.
Save cemayan/98aab831abe91522826c3d6d1195571d to your computer and use it in GitHub Desktop.
pipeline {
agent any
environment {
UNITY_USERNAME = credentials('UNITY_USERNAME')
UNITY_PASSWORD = credentials('UNITY_PASSWORD')
UNITY_SERIAL = credentials('UNITY_SERIAL')
TESTFLIGHT_USERNAME = credentials('TESTFLIGHT_USERNAME')
TESTFLIGHT_PASSWORD= credentials('TESTFLIGHT_PASSWORD')
}
stages {
stage('iOSBuild') {
steps {
sh '''
rm -rf Builds
echo "Unity Build starting..."
/Applications/Unity/Hub/Editor/2019.4.23f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath . -executeMethod Game.BuildActions.iOSDevelopment -username $UNITY_USERNAME -password $UNITY_PASSWORD -serial $UNITY_SERIAL -buildTarget ios -nographics -stackTraceLogType Full --silent-crashes
echo "Unity Build finished..."
'''
}
}
stage('iOSClean') {
steps {
sh '''
echo "xCode Clean Project starting..."
cd '/Users/***/.jenkins/workspace/***/Builds/iOS'
/usr/bin/xcodebuild -workspace Unity-iPhone.xcworkspace -scheme Unity-iPhone -sdk iphoneos -configuration Release clean
echo "xCode Clean Project finished..."
'''
}
}
stage('iOSArch') {
steps {
sh '''
echo "Create Archive starting..."
cd '/Users/***/.jenkins/workspace/***/Builds/iOS'
/usr/bin/xcodebuild -workspace Unity-iPhone.xcworkspace -scheme Unity-iPhone -sdk iphoneos -configuration Release archive -archivePath '../ios-build/***.xcarchive' clean
echo "Create Archive finished..."
'''
}
}
stage('iOSipa') {
steps {
sh '''
echo "Create ipa starting..."
cd '/Users/***/.jenkins/workspace/***/Builds/ios-build'
/usr/bin/xcodebuild -exportArchive -archivePath '***.xcarchive' -exportPath '.' -allowProvisioningUpdates -exportOptionsPlist '../../ios-conf/exportOptions.plist'
echo "Create ipa finished..."
'''
}
}
stage('iOSS3') {
steps {
sh '''
echo "S3 upload starting"
cd '/Users/***/.jenkins/workspace/***/Builds/ios-build'
/usr/local/bin/aws s3 cp ***.ipa s3://***/iOS/
echo "S3 upload completed"
'''
}
}
stage('iOSTestFlight') {
steps {
sh '''
echo "TesfFlight upload starting"
cd '/Users/***/.jenkins/workspace/***/Builds/ios-build'
/usr/bin/xcrun altool --upload-app --type ios --file ***.ipa --username $TESTFLIGHT_USERNAME --password $TESTFLIGHT_PASSWORD
echo "TesfFlight upload completed"
'''
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment