Skip to content

Instantly share code, notes, and snippets.

@onderceylan
Last active March 16, 2018 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onderceylan/326b2b2ea268bb83c0c0ad654fab3e9c to your computer and use it in GitHub Desktop.
Save onderceylan/326b2b2ea268bb83c0c0ad654fab3e9c to your computer and use it in GitHub Desktop.
CI scripts for hybrid mobile apps - Code signing preparation
#!/bin/bash
# Setup custom keychain
## Create a new keychain
security create-keychain -p "your-keychain-password-here" your-custom-keychain.keychain
security set-keychain-settings ~/Library/Keychains/your-custom-keychain.keychain-db
## Set default keychain
security default-keychain -s ~/Library/Keychains/your-custom-keychain.keychain-db
## Make codesign use the keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "your-keychain-password-here" ~/Library/Keychains/your-custom-keychain.keychain-db
## Unlock your keychain
security unlock-keychain -p "your-keychain-password-here" ~/Library/Keychains/your-custom-keychain.keychain-db
# Import provisioning profiles and certificates
## See match documentation https://docs.fastlane.tools/actions/match/ for the usage
fastlane match enterprise -u your-apple-dev-user@best-enterprise.com -a com.enterprise.your-1st-app,com.enterprise.your-2nd-app,com.enterprise.your-3rd-app --team_id YOUR_TEAM_ID_FROM_APPLE_DEV_PORTAL --git_url "https://bitbucket.com/ios-certificates.git" --keychain_name your-custom-keychain --keychain_password "your-keychain-password-here"
## If you're not able to use match somehow, you may consider following commented out path
## to replace match with cert & sigh in order to download provisioning profiles and certificates.
## See cert documentation here: https://docs.fastlane.tools/actions/cert/
## fastlane cert --development --team_id YOUR_TEAM_ID_FROM_APPLE_DEV_PORTAL --username your-apple-dev-user@best-enterprise.com --keychain_path ~/Library/Keychains/your-custom-keychain.keychain-db --keychain_password "your-keychain-password-here" --output_path ./.profiles
## See sigh documentation here: https://docs.fastlane.tools/actions/sigh/
## fastlane sigh download_all --download_xcode_profiles --team_id YOUR_TEAM_ID_FROM_APPLE_DEV_PORTAL --output_path ./.profiles
# Note that in order to let fastlane know your credentials, you need to set the following environment values to your CI.
# If your CI doesn't have such option to set env vars, you need to set them with command line.
# FASTLANE_USER="your-apple-dev-user@best-enterprise.com" FASTLANE_PASSWORD="your-apple-dev-user-password" MATCH_PASSWORD="this-is-the-password-you-set-during-setting-up-match"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment