like this:
package.json
packages/fastlane/
Fastfile
config.yml
apps/someapp/
package.json
ios/
android/
app/
App.tsx
App.test.tsx
fastlane/
Fastfile
config.yml
package.json
{
"name": "yourmonorepo",
"version": "0.0.1",
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"app:someapp": "yarn workspace @you/someapp",
...
}
}
packages/fastlane/config.yml
codesigning:
git_url: git+ssh://[email protected]/reponame.git
branch: master
packages/fastlane/Fastfile
fastlane_require 'config'
# this ends up always being `packages/fastlane`
HERE_DIR = File.expand_path(__dir__)
# different per app, but in the case of `someapp` it'll be `apps/someapp`
APP_ROOT = File.expand_path(File.dirname(Dir.pwd))
# the root of the repo, where your root package.json is
REPO_ROOT = File.expand_path('../..', __dir__)
STAGE_DEV = "development"
STAGE_PROD = "production"
Config.setup do |config|
config.use_env = true
config.env_prefix = 'YOU_FASTLANE'
config.env_separator = '__'
config.env_converter = :downcase
config.env_parse_values = true
end
Settings = Config.load_files(
"#{__dir__}/config.yml",
"#{Dir.pwd}/config.yml"
)
APPLICATION_ID = Settings.application.id
CRYPTEX_GITURL = Settings.codesigning.git_url
CRYPTEX_BRANCH = Settings.codesigning.branch
lane :setup do
Fastlane::LaneManager.cruise_lane(
'ios',
'keyfile_get',
{
'stage' => STAGE_DEV
}
)
Fastlane::LaneManager.cruise_lane(
'ios',
'keystore_get',
{
'stage' => STAGE_DEV
}
)
Fastlane::LaneManager.cruise_lane(
'android',
'keyfile_get',
{
'stage' => STAGE_DEV
}
)
Fastlane::LaneManager.cruise_lane(
'android',
'keystore_get',
{
'stage' => STAGE_DEV
}
)
end
platform :android do
lane :keystore_get do |options|
stage = options[:stage] || STAGE_DEV
UI.message("Fetched android #{stage} keystore from codesigning repo #{CRYPTEX_REPO}")
end
lane :keyfile_get do |options|
stage = options[:stage] || STAGE_DEV
UI.message("Fetched android #{stage} keyfile from codesigning repo #{CRYPTEX_REPO}")
end
lane :release_prod do
# do magic here
end
end
platform :ios do
lane :keystore_get do |options|
stage = options[:stage] || STAGE_DEV
UI.message("Fetched ios #{stage} keystore from codesigning repo #{CRYPTEX_REPO}")
end
lane :keyfile_get do |options|
stage = options[:stage] || STAGE_DEV
UI.message("Fetched ios #{stage} keyfile from codesigning repo #{CRYPTEX_REPO}")
end
lane :release_prod do
# do magic here
end
end
apps/someapp/package.json
{
"name": "@you/someapp",
"version": "0.0.1",
"scripts": {
"fastlane": "fastlane"
}
}
apps/someapp/fastlane/config.yml
application:
id: com.you.someapp
apps/someapp/fastlane/Fastfile
$VERBOSE = nil
import '../../../packages/fastlane/Fastfile'
Now you can run :
yarn app:someapp fastlane setup
or
yarn app:someapp fastlane ios keystore_get stage:'development'
yarn app:someapp fastlane android keystore_get stage:'development'
you can even in CI do :
YOU_FASTLANE__CODESIGNING__GIT_URL=https://github.com/your/repo.git \
yarn app:someapp fastlane ios release_prod
YOU_FASTLANE__CODESIGNING__GIT_URL=https://github.com/your/repo.git \
yarn app:someapp fastlane android release_prod
a few extras in here:
- yarn workspaces to facilitate monorepo
- the ruby config gem to facilitate something better than dotenv