-
-
Save joshdholtz/b4ff6480fe6c682da92cbf6713346aca to your computer and use it in GitHub Desktop.
Integrate fastlane into your Ionic/Cordova build process
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
FASTLANE_TEAM_ID = <your team id> | |
FASTLANE_USER = <your user email> | |
PRODUCE_APP_IDENTIFIER = com.fastlanescreencast.FastlaneScreencast | |
CERT_APP_IDENTIFIER = com.fastlanescreencast.FastlaneScreencast | |
SIGH_APP_IDENTIFIER = com.fastlanescreencast.FastlaneScreencast | |
ANDROID_KEYSTORE_KEYSTORE_NAME = FastlaneScreencast.keystore | |
ANDROID_KEYSTORE_ALIAS_NAME = fastlanescreencast | |
ANDROID_KEYSTORE_PASSWORD = supersecret | |
ANDROID_KEYSTORE_KEY_PASSWORD = supersecret | |
ANDROID_KEYSTORE_FULL_NAME = Fastlane Screencast | |
ANDROID_KEYSTORE_ORG = fastcast | |
ANDROID_KEYSTORE_ORG_UNIT = fastcast | |
ANDROID_KEYSTORE_CITY_LOCALITY = Chicago | |
ANDROID_KEYSTORE_STATE_PROVINCE = IL | |
ANDROID_KEYSTORE_COUNTRY = US |
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
ANDROID_KEYSTORE_KEYSTORE_NAME = FastlaneScreencast.keystore | |
ANDROID_KEYSTORE_ALIAS_NAME = fastlanescreencast | |
ANDROID_KEYSTORE_PASSWORD = supersecret | |
ANDROID_KEYSTORE_KEY_PASSWORD = supersecret | |
ANDROID_KEYSTORE_FULL_NAME = Fastlane Screencast | |
ANDROID_KEYSTORE_ORG = fastcast | |
ANDROID_KEYSTORE_ORG_UNIT = fastcast | |
ANDROID_KEYSTORE_CITY_LOCALITY = Chicago | |
ANDROID_KEYSTORE_STATE_PROVINCE = IL | |
ANDROID_KEYSTORE_COUNTRY = US |
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
FASTLANE_TEAM_ID = <your team id> | |
FASTLANE_USER = <your user email> | |
PRODUCE_APP_IDENTIFIER = com.fastlanescreencast.FastlaneScreencast | |
CERT_APP_IDENTIFIER = com.fastlanescreencast.FastlaneScreencast | |
SIGH_APP_IDENTIFIER = com.fastlanescreencast.FastlaneScreencast |
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
$: fastlane add_plugin android_keystore |
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
$: fastlane build android |
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
$: fastlane build ios |
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
platform :android do | |
lane :build do | |
# fastlane plugin added by running `fastlane add_plugin android_keystore` | |
output_directory = android_keystore(generate_cordova_release_signing: true) | |
UI.user_error! "`android_keystore` directory needs to exists" unless File.directory?(output_directory) | |
# Delete platforms/android so we always start from scratch | |
FileUtils.rm_rf('../platforms/android') | |
# Add Android platform to Ionic project | |
sh "(cd .. && ionic cordova platform add android)" | |
# Copy contents of ".android_signing" to platforms/android | |
FileUtils.cp_r Dir.glob("#{output_directory}/*"), '../platforms/android' | |
# Build Android release APK | |
sh "(cd .. && ionic cordova build android --release)" | |
# Get APK path | |
apk_path = Dir.glob(File.join(Dir.pwd, "../platforms/android/build/outputs/apk/*-release.apk")).first | |
apk_path = File.absolute_path apk_path | |
UI.success "Successfully built APK: #{apk_path}" | |
end | |
end | |
platform :ios do | |
lane :build do | |
# Create app in the iOS dev center | |
produce( | |
app_name: 'FastlaneScreencast', | |
language: 'English', | |
app_version: '1.0', | |
sku: 'FastlaneScreencast_001', | |
skip_itc: true # this will only create the app in the iOS dev center | |
) | |
# Create distribution cert | |
cert | |
# Create/fetch provisioning profile | |
profile_uuid = sigh | |
# Delete iOS platform | |
FileUtils.rm_rf('../platforms/ios') | |
# Add iOS platform | |
sh "(cd .. && ionic cordova platform add ios)" | |
# Creating build.json folder to be used for release signing | |
# This will get placed in our platforms/ios directory | |
build_json = { | |
"ios": { | |
"release": { | |
"codeSignIdentity": "iPhone Distribution", | |
"provisioningProfile": "#{profile_uuid}", | |
"packageType": "app-store", | |
"developmentTeam": ENV["FASTLANE_TEAM_ID"] | |
} | |
} | |
} | |
# Writing build.json to platforms/ios directory | |
out_file = File.new("../platforms/ios/build.json", "w") | |
out_file.puts(JSON.generate(build_json)) | |
out_file.close | |
# Build iOS release IPA | |
sh "(cd .. && ionic cordova build ios --device --prod --release --buildConfig=./platforms/ios/build.json)" | |
# Get IPA path | |
ipa_path = Dir.glob(File.join(Dir.pwd, "../platforms/ios/build/device/*.ipa")).first | |
ipa_path = File.absolute_path ipa_path | |
UI.success "Successfully built IPA: #{ipa_path}" | |
end | |
end |
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
platform :android do | |
lane :build do | |
# fastlane plugin added by running `fastlane add_plugin android_keystore` | |
output_directory = android_keystore(generate_cordova_release_signing: true) | |
UI.user_error! "`android_keystore` directory needs to exists" unless File.directory?(output_directory) | |
# Delete platforms/android so we always start from scratch | |
FileUtils.rm_rf('../platforms/android') | |
# Add Android platform to Ionic project | |
sh "(cd .. && ionic cordova platform add android)" | |
# Copy contents of ".android_signing" to platforms/android | |
FileUtils.cp_r Dir.glob("#{output_directory}/*"), '../platforms/android' | |
# Build Android release APK | |
sh "(cd .. && ionic cordova build android --release)" | |
# Get APK path | |
apk_path = Dir.glob(File.join(Dir.pwd, "../platforms/android/build/outputs/apk/*-release.apk")).first | |
apk_path = File.absolute_path apk_path | |
UI.success "Successfully built APK: #{apk_path}" | |
end | |
end |
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
platform :ios do | |
lane :build do | |
# Create app in the iOS dev center | |
produce( | |
app_name: 'FastlaneScreencast', | |
language: 'English', | |
app_version: '1.0', | |
sku: 'FastlaneScreencast_001', | |
skip_itc: true # this will only create the app in the iOS dev center | |
) | |
# Create distribution cert | |
cert | |
# Create/fetch provisioning profile | |
profile_uuid = sigh | |
# Delete iOS platform | |
FileUtils.rm_rf('../platforms/ios') | |
# Add iOS platform | |
sh "(cd .. && ionic cordova platform add ios)" | |
# Creating build.json folder to be used for release signing | |
# This will get placed in our platforms/ios directory | |
build_json = { | |
"ios": { | |
"release": { | |
"codeSignIdentity": "iPhone Distribution", | |
"provisioningProfile": "#{profile_uuid}", | |
"packageType": "app-store", | |
"developmentTeam": ENV["FASTLANE_TEAM_ID"] | |
} | |
} | |
} | |
# Writing build.json to platforms/ios directory | |
out_file = File.new("../platforms/ios/build.json", "w") | |
out_file.puts(JSON.generate(build_json)) | |
out_file.close | |
# Build iOS release IPA | |
sh "(cd .. && ionic cordova build ios --device --prod --release --buildConfig=./platforms/ios/build.json)" | |
# Get IPA path | |
ipa_path = Dir.glob(File.join(Dir.pwd, "../platforms/ios/build/device/*.ipa")).first | |
ipa_path = File.absolute_path ipa_path | |
UI.success "Successfully built IPA: #{ipa_path}" | |
end | |
end |
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
$: npm install cordova ionic | |
$: ionic start fastlaneScreencast | |
$: cd fastlaneScreencast | |
$: npm install --save-dev @ionic/cli-plugin-cordova | |
$: ionic serve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where do you put .env file?? what about project structure?