Skip to content

Instantly share code, notes, and snippets.

@maulikshah09
Last active December 21, 2024 09:13
Show Gist options
  • Save maulikshah09/830c23873ae6c942d765bbcaaa93b40f to your computer and use it in GitHub Desktop.
Save maulikshah09/830c23873ae6c942d765bbcaaa93b40f to your computer and use it in GitHub Desktop.
# 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
# Testing
#https://docs.fastlane.tools/actions/#testing
#building
#https://docs.fastlane.tools/actions/#building
#screenshot
#https://docs.fastlane.tools/actions/#screenshots
# bundle id
default_platform(:ios)
platform :ios do
# Define common variables
APP_IDENTIFIER = "com.example.app" # Replace with your app's bundle identifier
TEAM_ID = "YOUR_TEAM_ID" # Replace with your Apple Developer Team ID
OUTPUT_PATH = "./profiles" # Directory where profiles will be saved
APP_NAME = "YOUR_APPNAME"
PROJECT_FILENAME = "YOUR_PROJECTFILENAME"
SCHEME_NAME = "YOUR_SCHEME_NAME"
#Devlopment
# EXPORT_NAME = "ad-hoc" # Set export method (ad-hoc, app-store, enterprise, development
# CONFIGURATION_NAME = "Release" # Build configuration (Release or Debug)
# CODE_SIGN_IDENTITY = "iPhone Distribution: Your Custom Identity", # Custom signing identity
# PROVISIONING_PROFILE = "YourProvisioningProfile", # Optional: Specify custom provisioning profile
#
# #Adhoc
# EXPORT_NAME = "ad-hoc" # Set export method (ad-hoc, app-store, enterprise, development
# CONFIGURATION_NAME = "Release" # Build configuration (Release or Debug)
# CODE_SIGN_IDENTITY = "iPhone Distribution: Your Custom Identity", # Custom signing identity
# PROVISIONING_PROFILE = "YourProvisioningProfile", # Optional: Specify custom provisioning profile
#live
EXPORT_NAME = "ad-hoc" # Set export method (ad-hoc, app-store, enterprise, development
CONFIGURATION_NAME = "Release" # Build configuration (Release or Debug)
CODE_SIGN_IDENTITY = "iPhone Distribution: Your Custom Identity", # Custom signing identity
PROVISIONING_PROFILE = "YourProvisioningProfile", # Optional: Specify custom provisioning profile
# commmon Operations
# ========= SETUP APP ============ #
desc "First time app Create"
lane :setup_app do
make_dev_certificate
make_live_certificate
//bundleid
create_dev_profile
create_adhoc_profile
create_appstore_profile
end
# ========= UPLOAD APP ============ #
desc "Upload app to appstore"
lane :upload_live do
export_app
upload_appstore_app
end
desc "Upload app to testflight"
lane :upload_live do
export_app
upload_testflight_app
end
# All operation
# ========= CERTIFICATE ============ #
#Ref :https://docs.fastlane.tools/actions/cert/
#Make Developent certificate ##
desc "to Make New certificate for Developent"
lane :make_dev_certificate do
cert(
development: true # Indicates a Developent certificate
)
end
#Make destribution certificate
desc "to Make certificate for Distribute"
lane :make_live_certificate do
cert(
development: false # Indicates a distribution certificate
)
end
# ========= End CERTIFICATE ============ #
# ========= Budle id ============ #
# ========= End Bundle =========== #
# ========= Enable Services ============ #
# ========= End Enable Services =========== #
# ========= Provistion Profile ============ #
# Repair all provisioning profiles
lane :repair_profiles do
sigh(
repair: true, # This will trigger the repair process
app_identifier: APP_IDENTIFIER,
team_id: TEAM_ID,
output_path: OUTPUT_PATH
)
end
#Make Dev provisioning profile
lane :create_dev_profile do
sigh(
app_identifier: APP_IDENTIFIER,
development: true,
team_id: TEAM_ID,
provisioning_profile_name:"#{APP_NAME}_Dev",
output_path: OUTPUT_PATH
)
end
#Make Adhoc provisioning profile
lane :create_adhoc_profile do
sigh(
app_identifier: APP_IDENTIFIER,
adhoc: true,
team_id: TEAM_ID,
provisioning_profile_name: "#{APP_NAME}_Adhoc",
output_path: OUTPUT_PATH
)
end
#Make live provisioning profile
lane :create_appstore_profile do
sigh(
app_identifier: APP_IDENTIFIER,
appstore: true,
team_id: TEAM_ID,
provisioning_profile_name: "#{APP_NAME}_Live",
output_path: OUTPUT_PATH
)
end
# ========= End Provistion Profile =========== #
# ========= Export & upload App ============ #
# Export App
lane:export_app do
gym(
workspace:PROJECT_FILENAME,
project: PROJECT_FILENAME,
scheme: SCHEME_NAME,
clean: true,
export_method: EXPORT_NAME,
output_path: OUTPUT_PATH,
output_name: "#{APP_NAME}.ipa",
configuration: CONFIGURATION_NAME
code_sign_identity: CODE_SIGN_IDENTITY, # Custom signing identity
provisioning_profile: PROVISIONING_PROFILE, # Optional: Specify custom provisioning profile
)
end
# Upload App to appstore
lane:upload_appstore_app do
deliver(
ipa: "#{OUTPUT_PATH}/#{APP_NAME}.ipa", # Path to the .ipa file
skip_screenshots: true, # Skip uploading screenshots (optional)
skip_metadata: true, # Skip uploading metadata (optional)
skip_app_version_update: true,
force: true, # Force upload (use with caution)
)
end
# Upload App to testflight
lane:upload_testflight_app do
pilot(
ipa: "./output/YourApp.ipa", # Path to the .ipa file
skip_submission: true, # Skip submission for review (optional)
skip_app_version_update: true,
skip_waiting_for_build_processing: true # Skip waiting for build processing
)
end
# ========= End Provistion Profile =========== #
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment