native/ios/fastlane/Fastfile
fastlane_version "2.220.0"
require_relative "../../fastlane/read_build_config"
before_all do
setup_circle_ci
end
private_lane :apple_auth do |options|
ensure_env_vars(
env_vars: ["APP_STORE_CONNECT_API_KEY_ID", "APP_STORE_CONNECT_API_ISSUER_ID", "APP_STORE_CONNECT_API_KEY_CONTENT"]
)
app_store_connect_api_key(
key_id: ENV['APP_STORE_CONNECT_API_KEY_ID'],
issuer_id: ENV['APP_STORE_CONNECT_API_ISSUER_ID'],
key_content: Base64.decode64(ENV['APP_STORE_CONNECT_API_KEY_CONTENT'])
)
end
# The following parameters have to be passed:
# build_config_name: The build config which should be used
desc "Download and setup certificates"
lane :certificates do |options|
apple_auth
build_config_name = options[:build_config_name]
if [build_config_name].include?(nil)
raise "'nil' passed as parameter! Aborting..."
end
build_config = read_build_config(build_config_name, 'ios')
# https://docs.fastlane.tools/actions/match/
match(type: "appstore", app_identifier: build_config['bundleIdentifier'], readonly: true)
end
# The following parameters have to be passed:
# version_name: The version name the build should use
# version_code: The version code the build should use
# build_config_name: The build config which should be used
desc "Create a release build"
lane :build do |options|
version_code = options[:version_code]
version_name = options[:version_name]
build_config_name = options[:build_config_name]
if [version_code, version_name, build_config_name].include?(nil)
raise "'nil' passed as parameter! Aborting..."
end
apple_auth
# DO NOT OVERWRITE THE BUNDLE_CONFIG ENV VARIABLE! It is used by ruby bundle.
ENV["EXTRA_PACKAGER_ARGS"] = "--sourcemap-output ios/output/#{build_config_name}.ios.bundle.map"
# DO NOT REMOVE THIS! It is necessary for the javascript build config logic.
ENV["BUILD_CONFIG_NAME"] = build_config_name
build_config = read_build_config(build_config_name, 'ios')
# https://docs.fastlane.tools/actions/match/
match(type: "development", app_identifier: build_config['bundleIdentifier'], readonly: true)
match(type: "appstore", app_identifier: build_config['bundleIdentifier'], readonly: true)
increment_build_number(
build_number: version_code
)
increment_version_number(
version_number: version_name
)
build_app(
workspace: "Integreat.xcworkspace",
scheme: build_config_name,
output_name: "#{build_config_name}.ipa",
export_method: "app-store",
include_bitcode: false # Uploading to BrowserStack does not work when including Bitcode
)
end