2022-08-15 14:27:38 +00:00
|
|
|
# This file contains the fastlane.tools configuration
|
|
|
|
# You can find the documentation at https://docs.fastlane.tools
|
|
|
|
#
|
|
|
|
# For a list of all available actions, check out
|
|
|
|
#
|
|
|
|
# https://docs.fastlane.tools/actions
|
|
|
|
#
|
|
|
|
# For a list of all available plugins, check out
|
|
|
|
#
|
|
|
|
# https://docs.fastlane.tools/plugins/available-plugins
|
|
|
|
#
|
|
|
|
|
|
|
|
# Uncomment the line if you want fastlane to automatically update itself
|
|
|
|
# update_fastlane
|
|
|
|
|
2023-02-25 12:59:49 +00:00
|
|
|
APP_NAME = ENV['APP_NAME']
|
2022-08-15 14:27:38 +00:00
|
|
|
DEVELOPER_KEY_ID = ENV['DEVELOPER_KEY_ID']
|
|
|
|
DEVELOPER_KEY_ISSUER_ID = ENV['DEVELOPER_KEY_ISSUER_ID']
|
2023-02-19 13:18:58 +00:00
|
|
|
DEVELOPER_KEY_CONTENT = ENV['DEVELOPER_KEY_CONTENT']
|
2023-02-19 13:43:17 +00:00
|
|
|
TEAM_ID = ENV['TEAM_ID']
|
|
|
|
TEMP_KEYCHAIN_USER = ENV['TEMP_KEYCHAIN_USER']
|
|
|
|
TEMP_KEYCHAIN_PASSWORD = ENV['TEMP_KEYCHAIN_PASSWORD']
|
|
|
|
DEVELOPER_APP_IDENTIFIER = ENV['DEVELOPER_APP_IDENTIFIER']
|
|
|
|
GIT_AUTHORIZATION = ENV['GIT_AUTHORIZATION']
|
|
|
|
TESTFLIGHT_EXTERNAL_GROUPS = ENV['TESTFLIGHT_EXTERNAL_GROUPS']
|
|
|
|
|
2023-02-25 12:59:49 +00:00
|
|
|
XCODEPROJ = "#{APP_NAME}.xcodeproj"
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
def delete_temp_keychain(name)
|
|
|
|
delete_keychain(
|
|
|
|
name: name
|
|
|
|
) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db")
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_temp_keychain(name, password)
|
|
|
|
create_keychain(
|
|
|
|
name: name,
|
|
|
|
password: password,
|
|
|
|
unlock: false,
|
|
|
|
timeout: 0
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_temp_keychain(name, password)
|
|
|
|
delete_temp_keychain(name)
|
|
|
|
create_temp_keychain(name, password)
|
|
|
|
end
|
2022-08-15 14:27:38 +00:00
|
|
|
|
|
|
|
add_extra_platforms(platforms: [:tvos])
|
|
|
|
|
|
|
|
before_all do
|
|
|
|
update_fastlane
|
|
|
|
end
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
desc "Bump build number and commit"
|
|
|
|
lane :bump_build do
|
2023-02-26 17:45:58 +00:00
|
|
|
increment_build_number(xcodeproj: XCODEPROJ)
|
2023-02-25 12:59:49 +00:00
|
|
|
|
2023-02-26 17:45:58 +00:00
|
|
|
commit_version_bump(
|
|
|
|
message: "Bump build number to #{get_build_number(xcodeproj: XCODEPROJ)}",
|
|
|
|
xcodeproj: XCODEPROJ
|
|
|
|
)
|
2023-02-19 13:43:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Bump version number and commit"
|
|
|
|
lane :bump_version do
|
|
|
|
increment_version_number
|
|
|
|
commit_version_bump(
|
2023-02-25 12:59:49 +00:00
|
|
|
message: "Bump version number to #{get_version_number}",
|
|
|
|
xcodeproj: XCODEPROJ
|
2023-02-19 13:43:17 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2022-08-15 14:27:38 +00:00
|
|
|
platform :ios do
|
|
|
|
desc "Push a new beta build to TestFlight"
|
|
|
|
lane :beta do
|
2023-02-19 13:43:17 +00:00
|
|
|
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
|
|
|
|
|
|
|
|
api_key = app_store_connect_api_key(
|
2022-08-15 14:27:38 +00:00
|
|
|
key_id: DEVELOPER_KEY_ID,
|
|
|
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
2023-02-19 13:18:58 +00:00
|
|
|
key_content: DEVELOPER_KEY_CONTENT
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-25 12:59:49 +00:00
|
|
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
2022-08-15 14:27:38 +00:00
|
|
|
version = get_version_number(
|
2023-02-25 12:59:49 +00:00
|
|
|
xcodeproj: XCODEPROJ,
|
|
|
|
target: "#{APP_NAME} (iOS)"
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
match(
|
|
|
|
type: 'appstore',
|
|
|
|
platform: 'ios',
|
2023-02-25 12:59:49 +00:00
|
|
|
app_identifier: ["#{DEVELOPER_APP_IDENTIFIER}", "#{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}"],
|
2023-02-19 13:43:17 +00:00
|
|
|
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
|
|
|
|
readonly: true,
|
|
|
|
keychain_name: TEMP_KEYCHAIN_USER,
|
|
|
|
keychain_password: TEMP_KEYCHAIN_PASSWORD,
|
|
|
|
api_key: api_key
|
|
|
|
)
|
|
|
|
|
2022-08-15 14:27:38 +00:00
|
|
|
build_app(
|
2023-02-25 12:59:49 +00:00
|
|
|
scheme: "#{APP_NAME} (iOS)",
|
2022-08-15 14:55:18 +00:00
|
|
|
output_directory: "fastlane/builds/#{version}-#{build}/iOS",
|
2023-02-25 12:59:49 +00:00
|
|
|
output_name: "#{APP_NAME}-#{version}-iOS.ipa",
|
2023-02-19 13:43:17 +00:00
|
|
|
export_options: {
|
|
|
|
provisioningProfiles: {
|
|
|
|
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}",
|
2023-02-25 12:59:49 +00:00
|
|
|
"#{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}"
|
2023-02-19 13:43:17 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
changelog = File.read('../CHANGELOG.md')
|
|
|
|
|
|
|
|
upload_to_testflight(
|
|
|
|
api_key: api_key,
|
|
|
|
ipa: lane_context[SharedValues::IPA_OUTPUT_PATH],
|
2024-01-13 09:08:53 +00:00
|
|
|
# distribute_external: true,
|
|
|
|
# groups: TESTFLIGHT_EXTERNAL_GROUPS,
|
2023-02-19 13:43:17 +00:00
|
|
|
changelog: changelog
|
2022-08-15 15:14:09 +00:00
|
|
|
)
|
2022-08-15 14:27:38 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
platform :tvos do
|
|
|
|
desc "Push a new beta build to TestFlight"
|
|
|
|
lane :beta do
|
2023-02-19 13:43:17 +00:00
|
|
|
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
|
|
|
|
|
|
|
|
api_key = app_store_connect_api_key(
|
2022-08-15 14:27:38 +00:00
|
|
|
key_id: DEVELOPER_KEY_ID,
|
|
|
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
2023-02-19 13:18:58 +00:00
|
|
|
key_content: DEVELOPER_KEY_CONTENT
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-25 12:59:49 +00:00
|
|
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
2022-08-15 14:27:38 +00:00
|
|
|
version = get_version_number(
|
2023-02-25 12:59:49 +00:00
|
|
|
xcodeproj: XCODEPROJ,
|
|
|
|
target: "#{APP_NAME} (tvOS)"
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
match(
|
|
|
|
type: 'appstore',
|
|
|
|
platform: 'tvos',
|
|
|
|
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
|
|
|
|
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
|
|
|
|
readonly: true,
|
|
|
|
keychain_name: TEMP_KEYCHAIN_USER,
|
|
|
|
keychain_password: TEMP_KEYCHAIN_PASSWORD,
|
|
|
|
api_key: api_key
|
|
|
|
)
|
|
|
|
|
2022-08-15 14:27:38 +00:00
|
|
|
build_app(
|
2023-02-25 12:59:49 +00:00
|
|
|
scheme: "#{APP_NAME} (tvOS)",
|
2022-08-15 14:55:18 +00:00
|
|
|
output_directory: "fastlane/builds/#{version}-#{build}/tvOS",
|
2023-02-25 12:59:49 +00:00
|
|
|
output_name: "#{APP_NAME}-#{version}-tvOS.ipa",
|
2023-02-19 13:43:17 +00:00
|
|
|
export_method: "app-store",
|
|
|
|
export_options: {
|
|
|
|
provisioningProfiles: {
|
|
|
|
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER} tvos"
|
|
|
|
}
|
|
|
|
}
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
changelog = File.read('../CHANGELOG.md')
|
|
|
|
|
|
|
|
upload_to_testflight(
|
|
|
|
api_key: api_key,
|
|
|
|
ipa: lane_context[SharedValues::IPA_OUTPUT_PATH],
|
2024-01-13 09:08:53 +00:00
|
|
|
# distribute_external: true,
|
|
|
|
# groups: TESTFLIGHT_EXTERNAL_GROUPS,
|
2023-02-19 13:43:17 +00:00
|
|
|
changelog: changelog
|
2022-08-15 15:14:09 +00:00
|
|
|
)
|
2022-08-15 14:27:38 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
platform :mac do
|
|
|
|
desc "Push a new beta build to TestFlight"
|
|
|
|
lane :beta do
|
2023-02-19 13:43:17 +00:00
|
|
|
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
|
|
|
|
|
|
|
|
api_key = app_store_connect_api_key(
|
2022-08-15 14:27:38 +00:00
|
|
|
key_id: DEVELOPER_KEY_ID,
|
|
|
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
2023-02-19 13:18:58 +00:00
|
|
|
key_content: DEVELOPER_KEY_CONTENT
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-25 12:59:49 +00:00
|
|
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
2022-08-15 14:27:38 +00:00
|
|
|
version = get_version_number(
|
2023-02-25 12:59:49 +00:00
|
|
|
xcodeproj: XCODEPROJ,
|
|
|
|
target: "#{APP_NAME} (macOS)"
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
match(
|
|
|
|
type: 'appstore',
|
|
|
|
platform: 'macos',
|
|
|
|
additional_cert_types: ['mac_installer_distribution'],
|
|
|
|
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
|
|
|
|
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
|
|
|
|
readonly: true,
|
|
|
|
keychain_name: TEMP_KEYCHAIN_USER,
|
|
|
|
keychain_password: TEMP_KEYCHAIN_PASSWORD,
|
|
|
|
api_key: api_key
|
|
|
|
)
|
|
|
|
|
2022-08-15 14:27:38 +00:00
|
|
|
build_app(
|
2023-02-25 12:59:49 +00:00
|
|
|
scheme: "#{APP_NAME} (macOS)",
|
2022-08-15 14:55:18 +00:00
|
|
|
output_directory: "fastlane/builds/#{version}-#{build}/macOS",
|
2023-02-25 12:59:49 +00:00
|
|
|
output_name: "#{APP_NAME}-#{version}-macOS.app",
|
2023-02-19 13:43:17 +00:00
|
|
|
export_method: "app-store",
|
|
|
|
export_options: {
|
|
|
|
provisioningProfiles: {
|
|
|
|
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER} macos"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
changelog = File.read('../CHANGELOG.md')
|
|
|
|
|
|
|
|
upload_to_testflight(
|
|
|
|
api_key: api_key,
|
|
|
|
pkg: lane_context[SharedValues::PKG_OUTPUT_PATH],
|
2024-01-13 09:08:53 +00:00
|
|
|
# distribute_external: true,
|
|
|
|
# groups: TESTFLIGHT_EXTERNAL_GROUPS,
|
2023-02-19 13:43:17 +00:00
|
|
|
changelog: changelog
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Build for Developer ID distribution and notarize"
|
|
|
|
lane :build_and_notarize do
|
|
|
|
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
|
|
|
|
|
|
|
|
api_key = app_store_connect_api_key(
|
|
|
|
key_id: DEVELOPER_KEY_ID,
|
|
|
|
issuer_id: DEVELOPER_KEY_ISSUER_ID,
|
|
|
|
key_content: DEVELOPER_KEY_CONTENT
|
|
|
|
)
|
|
|
|
|
2023-02-25 12:59:49 +00:00
|
|
|
build = get_build_number(xcodeproj: XCODEPROJ)
|
2023-02-19 13:43:17 +00:00
|
|
|
version = get_version_number(
|
2023-02-25 12:59:49 +00:00
|
|
|
xcodeproj: XCODEPROJ,
|
|
|
|
target: "#{APP_NAME} (macOS)"
|
2023-02-19 13:43:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
match(
|
|
|
|
type: 'developer_id',
|
|
|
|
platform: 'macos',
|
|
|
|
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
|
|
|
|
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
|
|
|
|
readonly: true,
|
|
|
|
keychain_name: TEMP_KEYCHAIN_USER,
|
|
|
|
keychain_password: TEMP_KEYCHAIN_PASSWORD,
|
|
|
|
api_key: api_key
|
|
|
|
)
|
|
|
|
|
|
|
|
build_mac_app(
|
2023-02-25 12:59:49 +00:00
|
|
|
scheme: "#{APP_NAME} (macOS)",
|
2023-02-19 13:43:17 +00:00
|
|
|
output_directory: "fastlane/builds/#{version}-#{build}/macOS",
|
2023-02-25 12:59:49 +00:00
|
|
|
output_name: "#{APP_NAME}",
|
2023-02-19 13:43:17 +00:00
|
|
|
export_method: "developer-id",
|
|
|
|
export_options: {
|
|
|
|
provisioningProfiles: {
|
|
|
|
"#{DEVELOPER_APP_IDENTIFIER}" => "match Direct #{DEVELOPER_APP_IDENTIFIER} macos"
|
|
|
|
}
|
|
|
|
}
|
2022-08-15 14:27:38 +00:00
|
|
|
)
|
|
|
|
|
2023-02-19 13:43:17 +00:00
|
|
|
notarize(
|
2023-02-25 12:59:49 +00:00
|
|
|
package: "fastlane/builds/#{version}-#{build}/macOS/#{APP_NAME}.app",
|
2023-02-19 13:43:17 +00:00
|
|
|
bundle_id: "#{DEVELOPER_APP_IDENTIFIER}",
|
|
|
|
api_key: api_key,
|
2022-08-15 15:14:09 +00:00
|
|
|
)
|
2022-08-15 14:27:38 +00:00
|
|
|
end
|
|
|
|
end
|