Skip to content

Instantly share code, notes, and snippets.

@AttilaBerczik
Last active December 21, 2023 13:27
Show Gist options
  • Save AttilaBerczik/d6a07428d610b4237e50faec2e62a471 to your computer and use it in GitHub Desktop.
Save AttilaBerczik/d6a07428d610b4237e50faec2e62a471 to your computer and use it in GitHub Desktop.
Build script for IOS CI/CD Pipeline
# Create build folder
cd
mkdir build
cd build
# Download repository from Bitbucket
git clone {your git repo}
cd {the name of your git repo}/
# Install dependencies
# These exports are necessary for yarn and pod to work
export PATH="/Users/user111111/.nvm/versions/node/v14.17.6/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/munki:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin"
export LANG=en_US.UTF-8
yarn install
cd ios/
pod repo update
pod install
# Build with Xcode's command line interface
# Unlock keychain
security unlock-keychain -p $macPassword /Users/user111111/Library/Keychains/login.keychain-db
# Archive project
xcodebuild -workspace {your workspace}.xcworkspace -scheme {your scheme} -configuration Release clean archive -archivePath ../builds/{your workspace}.xcarchive -allowProvisioningUpdates DEVELOPMENT_TEAM={yourdevteamid}
# Export project .ipa file
xcodebuild -exportArchive -archivePath ../builds/{your workspace}.xcarchive PROVISIONING_PROFILE_SPECIFIER="your-profile" -exportOptionsPlist ../ios-build/exportOptions.plist -exportPath ../builds/ -UseModernBuildSystem=NO CODE_SIGN_STYLE="Manual" CODE_SIGN_IDENTITY="Apple Distribution: your code sign identity"
# Finally, publish the app!
xcrun altool --upload-app --file /Users/user111111/build/{the name of your git repo}/builds/{your workspace}.ipa --username $appStoreUsername --password $appStoreAccountPassword
# Delete the build folder
cd
rm -rf build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment