Last active
May 20, 2019 12:52
-
-
Save aidansteele/0603dfa00164b9c7662d69f507fa4437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hockeyApiToken = '<elided>' | |
node('xcode8') { // node() is how we specify which build agent we want to run on | |
color { | |
stage('checkout') { // stage() is how we label parts of our pipeline. they can be visualised in the web ui. | |
checkout scm // we have to pull our code down from git first! | |
} | |
stage('bundler') { | |
// we use ruby's bundler to ensure our versions of cocoapods and fastlane are correct | |
sh 'bundle install' | |
} | |
stage('cocoapods') { | |
sh 'bundle exec pod install' // cocoapods is used to manage our third-party dependencies | |
} | |
stage('tests') { | |
// xcodebuild is a custom Jenkinsfile function we wrote ourselves | |
// every great project has a great test suite, right? | |
xcodebuild 'test', [ | |
workspace: 'Pacifica.xcworkspace', | |
scheme: 'TaxTouch', | |
destination: 'platform=iOS Simulator,name=iPhone 6', | |
derivedDataPath: 'derivedData' | |
] | |
} | |
stage('staging') { | |
// build for hockeyapp for daily internal testing within the team | |
xcodebuild 'archive', [ | |
workspace: 'Pacifica.xcworkspace', | |
scheme: 'TaxTouch Hockey Test', | |
archivePath: 'hockey.xcarchive', | |
derivedDataPath: 'derivedData' | |
] | |
archive 'hockey.xcarchive/**' | |
} | |
stage('stg ipa') { | |
// hockeyapp wants an IPA | |
xcodebuild 'exportArchive', [ | |
archivePath: 'hockey.xcarchive', | |
exportFormat: 'IPA', | |
exportPath: 'hockey.ipa', | |
exportWithOriginalSigningIdentity: 'true' | |
] | |
} | |
if (env.BRANCH_NAME == 'develop') { | |
stage('hockey upload') { | |
fastlane 'dsym_zip', [archive_path: 'hockey.xcarchive'] | |
// fastlane() here is another custom helper we wrote ourselves. | |
// upload the IPA and symbols to hockeyapp | |
fastlane 'hockey', [ | |
api_token: hockeyApiToken, | |
ipa: 'hockey.ipa', | |
commit_sha: env.GIT_COMMIT, | |
notify: '0' | |
] | |
} | |
} | |
if (env.BRANCH_NAME == 'master') { | |
// build for the app store! | |
stage('production') { | |
xcodebuild 'archive', [ | |
workspace: 'Pacifica.xcworkspace', | |
scheme: 'TaxTouch', | |
archivePath: 'appstore.xcarchive', | |
derivedDataPath: 'derivedData' | |
] | |
archive 'appstore.xcarchive/**' | |
} | |
stage('prod ipa') { | |
// testflight wants an IPA | |
xcodebuild 'exportArchive', [ | |
archivePath: 'appstore.xcarchive', | |
exportFormat: 'IPA', | |
exportPath: 'appstore.ipa', | |
exportWithOriginalSigningIdentity: 'true' | |
] | |
} | |
stage('testflight push') { | |
// submission to testflight requires an itunes connect username and password. we don't | |
// want to store that in code, so we use jenkins' credentials for that | |
withCredentials([[ | |
$class: 'UsernamePasswordMultiBinding', | |
credentialsId: 'itunesconnect', | |
usernameVariable: 'FASTLANE_USER', | |
passwordVariable: 'FASTLANE_PASSWORD' | |
]]) { | |
fastlane 'pilot', [ | |
ipa: 'appstore.ipa', | |
skip_submission: true, | |
skip_waiting_for_build_processing: true | |
] | |
} | |
} | |
stage('prod syms to hockeyapp') { | |
// we also want hockeyapp crash logging in production! | |
fastlane 'dsym_zip', [archive_path: 'appstore.xcarchive'] | |
fastlane 'hockey', [ | |
api_token: hockeyApiToken, | |
dsym: 'appstore.app.dSYM.zip', | |
upload_dsym_only: true, | |
commit_sha: env.GIT_COMMIT, | |
release_type: "1" // app store | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment