This has been a very UNsatisfactory couple of weeks. I guess I thought Fastlane was going to be easy to understand and use... nope - it takes a lot of work and effort. And that is a shame - because with some better "default" behavior and better tool initalization - I feel Fastlane could be easy and fast to learn and use successfully.
I've got so many long and hard to understand Apple Notes pages on Fastlane. Most started AFTER I decided I didn't GROK it and needed to start back at the beginning and attempt to understand the tool suite from it's point of view.
But finding this "view point" in the Docs is not possible...
I think this intro video by iLane best puts you in the correct frame of mind when asking WHY Fastlane? Don't know why they stop producing this at 5 videos... before they finished the series. They are 4 years old.... but much better than most intro tutorials.
In short - Fastlane wants to put all the configuration required to build - certify - sign - deploy - distrbute - market your next app into a repeatable process and stash it away in a REPO that the whole team can use. No more - "we can't deploy until Jack gets back in the office" - no more excusses. A big step toward Continious Deployment.
I'm attempting to build a rather simple App. And while building it in SwiftUI, I plan on Transpiling to Android. That dual nature of the deliverables will throw more than one challenge in the process.
Now my colleague said something to the effect of: "oh, yeah today is the best day to deploy - the next best day was right after you got Hello World to run!"
So with that advice I've spent the last 2 weeks working more on deployment infrastructure for my App and Hello World. If you cannot successfully AND repeatedly deploy - you do not have control - you are NOT a MASTER of your domain.
So I'm about 10 weeks into the App dev process... I didn't much think about deploying the very first running code.
I went back to Skip.tools HelloWorld example app... I've been learning and stumbling over it for weeks now. Perhaps I've enough bruises to help you along this journey (assuming you want to go down this path).
Fastlane folder with some of the configuration and resource files.
To get a Hello World Skip dual platform App started - use this:
❯ skip init --fastlane --appid=com.goodcompany.HelloWorld helloPrj HelloWorld
This shell command will put a new project folder structure on you disk at the "helloPrj" folder. Inside it will be divided into many subfolders - mainly the two platforms Android & Darwin (some long forgotten name for a new Mac paradigm). For the most part these two folders are infrastructure for the platform. The main two folders are of course: Sources & Tests.
If you are looking for the proper starting file... in a SwiftUI App that is typically ContentView.swift inside Sources/HelloWorld/ folder. Do NOT be fooled by similar named files in the platform folders - they are generated files.
Now because you used the --fastlane flag, the folder structure inside the platform folders (Android & Darwin) both contain the fastlane folder - the keeper of Fastlane's configuration files (mostly). Most of Fastlane's config files are named for the specific tool and appended with "file". They are written in Ruby script. For example: Fastfile - the major config file with the definition of "lanes". This concept of lanes becomes the metaphor for all the tools in the suite. Another is the Appfile - which describes your app HelloWorld. The Deliverfile - describes the configuration for the AppStore.
Let's go thru these major configuration files.
As I'm learning... these examples may update any minute.
Appfile
# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
require('dotenv')
Dotenv.load '../../Skip.env'
app_identifier(ENV['PRODUCT_BUNDLE_IDENTIFIER'])
apple_id("myName@goodCompany.com")
Note this is refering to the Skip.env file. It is NOT in Ruby syntax. Which looks like:
Skip.env
// The configuration file for your Skip App (https://skip.tools).
// Properties specified here are shared between
// Darwin/HelloWorld.xcconfig and Android/settings.gradle.kts
// and will be included in the app's metadata files
// Info.plist and AndroidManifest.xml
// PRODUCT_NAME is the default title of the app, which must match the app's Swift module name
PRODUCT_NAME = HelloWorld
// PRODUCT_BUNDLE_IDENTIFIER is the unique id for both the iOS and Android app
PRODUCT_BUNDLE_IDENTIFIER = com.goodcompany.HelloWorld
// The semantic version of the app
MARKETING_VERSION = 0.0.1
// The build number specifying the internal app version
CURRENT_PROJECT_VERSION = 1
// The package name for the Android entry point, referenced by the AndroidManifest.xml
ANDROID_PACKAGE_NAME = helloworld
This is the file where you will do customization. Why Fastlane doesn't deploy with resonable working code in Fastfile - well it's making this much harder than it needs to be.
Fastfile
# This file contains the fastlane.tools configuration
# for the iOS half of the Skip app.
# You can find the documentation at https://docs.fastlane.tools
default_platform(:ios)
lane :assemble do |options|
# only build the iOS side of the app
ENV["SKIP_ZERO"] = "true"
build_app(
sdk: "iphoneos",
xcconfig: "fastlane/AppStore.xcconfig",
xcargs: "-skipPackagePluginValidation -skipMacroValidation",
derived_data_path: "../.build/Darwin/DerivedData",
output_directory: "../.build/fastlane/Darwin",
skip_archive: ENV["FASTLANE_SKIP_ARCHIVE"] == "YES",
skip_codesigning: ENV["FASTLANE_SKIP_CODESIGNING"] == "YES"
)
end
lane :release do |options|
desc "Build and release app"
assemble
upload_to_app_store(
api_key_path: "fastlane/apikey.json",
app_rating_config_path: "fastlane/metadata/rating.json",
release_notes: { default: "Fixes and improvements." }
)
end
The first thing to do in the Deliverfile is comment OUT with a # (hash symbol) the line:
# default_language("en-US")
This Fastlane symbol 'default_language' has been depreacated years ago and deleted.
Deliverfile
copyright "#{Time.now.year}"
default_language("en-US")
force(true) # Skip HTML report verification
automatic_release(true)
skip_screenshots(false)
precheck_include_in_app_purchases(false)
#skip_binary_upload(true)
submit_for_review(true)
submission_information({
add_id_info_serves_ads: false,
add_id_info_uses_idfa: false,
add_id_info_tracks_install: false,
add_id_info_tracks_action: false,
add_id_info_limits_tracking: false,
content_rights_has_rights: false,
content_rights_contains_third_party_content: false,
export_compliance_contains_third_party_cryptography: false,
export_compliance_encryption_updated: false,
export_compliance_platform: 'ios',
export_compliance_compliance_required: false,
export_compliance_uses_encryption: false,
export_compliance_is_exempt: false,
export_compliance_contains_proprietary_cryptography: false
})
Well here is my current HelloWorld example Fastfile. Maybe you can get up and running much faster if you copy it.
(BETTER) Fastfile
# This file contains the fastlane.tools configuration
# for the iOS half of the Skip app.
# You can find the documentation at https://docs.fastlane.tools
default_platform(:ios)
desc "iOS unit test via Fastlane"
lane :tests do
run_tests(scheme: "HelloWorldTests" )
end
desc "iOS UI-Tests via Fastlane"
lane :UItests do
run_tests(workspace: "Example.xcworkspace",
devices: ["iPhone 15", "iPad Air" ],
scheme: "MyAppUITest")
end
lane :assemble do |options|
# only build the iOS side of the app
ENV["SKIP_ZERO"] = "true"
build_app(
sdk: "iphoneos",
xcconfig: "fastlane/AppStore.xcconfig",
xcargs: "-skipPackagePluginValidation -skipMacroValidation",
derived_data_path: "../.build/Darwin/DerivedData",
output_directory: "../.build/fastlane/Darwin",
skip_archive: ENV["FASTLANE_SKIP_ARCHIVE"] == "YES",
skip_codesigning: ENV["FASTLANE_SKIP_CODESIGNING"] == "YES"
)
end
lane :beta do
# see code signing guide https://docs.fastlane.tools/codesigning/getting-started/
sync_code_signing(type: "appstore")
build_app(scheme: "MyApp")
changelog_from_git_commits # make a changelog in testflight
upload_to_testflight
# slack(message: "Successfully distributed a new beta build")
end
lane :release do |options|
desc "Build and release app"
assemble
upload_to_app_store(
api_key_path: "fastlane/apikey.json",
app_rating_config_path: "fastlane/metadata/rating.json",
release_notes: { default: "Fixes and improvements." }
)
end
Big Trucks run Dual Tires...
For redundancy & load.
NOT AT ALL - why I'm doing a dual platform App.
If I complain that Fastlane SUCKS ... just politely ask me if I've got Android-Studio running and a Pixel 6 device in their Virtual Device Simulator running? Because if I don't - there is a great chance that the Xcode Build & Run is failing... with some weird message - that should NEVER happen.
Living inside a DUAL Platform World is tough... it gets doublely complix really fast!
By-the-way this is coming from the SKIP.tools requirement for Transpiling to Android. Not at all from the Fastlane tool set. Just to be clear.... but I would not have Fastlane if not for Skip.
... and MORE to come....