Skip to content

Instantly share code, notes, and snippets.

@codesalley
Last active March 6, 2025 23:37
Show Gist options
  • Save codesalley/c2b28dde1b3eed34dc9b6c025ec01130 to your computer and use it in GitHub Desktop.
Save codesalley/c2b28dde1b3eed34dc9b6c025ec01130 to your computer and use it in GitHub Desktop.
platform :ios do
desc "Setup keychain"
lane :setup_keychain do
delete_keychain(
name: keychain-name
) if File.exist? File.expand_path("~/Library/Keychains/keychain-name-db")
create_keychain(
name: keychain-name,
password: keychain-password,
default_keychain: true,
unlock: true,
timeout: 3600
)
end
desc "Build and publish to testflight"
lane :build_and_publish_ios do
api_key = app_store_connect_api_key(
key_id: ENV['APPSTORE_KEY_ID'],
issuer_id: ENV['APPSTORE_ISSUER_ID'],
key_filepath: ENV['APPSTORE_KEY_PATH'],
in_house: false
)
match(
type: "appstore",
app_identifier: 'com.example',
verbose: true,
api_key: api_key,
keychain_name: keychain-name,
keychain_password: keychain-password
)
version = get_version_number(
xcodeproj: "ios/ExampleApp.xcodeproj",
target: "exampleApp"
)
current_build_number = latest_testflight_build_number(version: version, api_key: api_key, app_identifier: "com.exmaple")
increment_build_number(
xcodeproj: "ios/exampleApp.xcodeproj",
build_number: current_build_number + 1
)
build_app(
scheme: "exampleApp",
workspace: "ios/exampleApp.xcworkspace",
export_method: "app-store",
clean: true,
verbose: true,
export_options: {
export_method: "app-store",
team_id: '123TEAM_ID',
}
)
upload_to_testflight(
skip_waiting_for_build_processing: true,
api_key: api_key,
changelog: "New Build"
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment