1 CD Root directory of the project

fastlane init
Copy the code

2 Select Custom 3 Configuration file

# 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

default_platform(:ios)


#targets = ['ElbC', 'ElbT', 'ElbF']
targets = ['ElbALL'.'ElbC'.'ElbC online'.'ElbF'.'ElbF online'.'ElbT'.'ElbT online']


ALL_DIR = Time.now.strftime("%Y-%m-%d %H:%M:%S")


platform :ios do
  

desc "ElbT Test Version"
  lane :ElbT do 
    gym(scheme:"ElbT",
        export_method:"enterprise",
        output_directory:"~/Desktop/App/ElbT/".# file path
	output_name:"ElbT--#{ALL_DIR}.ipa"

         )
    end
lane :all do
targets.each do |t|
    gym(scheme:t,
        export_method:"enterprise",
        output_directory:"~/Desktop/App/All/#{ALL_DIR}/".# file path
	output_name:"#{t}--#{ALL_DIR}.ipa"
         )
end
end
end

Copy the code

4 Switch the execution terminal to fastlane of the project

Example Pack a single ElbT fastlane ElbT

Pack all Fastlane All in one click

5 Packaging Process

Update package complete email automatically sent

# 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

default_platform(:ios)


#targets = ['ElbC', 'ElbT', 'ElbF']
targets = ['ElbALL'.'ElbC'.'ElbC online'.'ElbF'.'ElbF online'.'ElbT'.'ElbT online']


ALL_DIR = Time.now.strftime("%Y-%m-%d-%H-%M-%S")


platform :ios do
  

desc "App packaging function"
  lane :App do
  # before deleting
      # exec "rm -rf rm -rf App"

puts "Please select in order (starting from 0):"
for index in0.. targets.length - 1do
    item = targets[index]
    puts "#{index} #{item}\n"
end
$name = STDIN.gets
$name = $name.chomp
puts $name
$name = $name.to_i # Convert to a number
while $name< 0 | |$name > targets.length do
	puts "Please select in order (starting from 0):#{targets}"
	$name = STDIN.gets
	$name = $name.chomp
	puts $name
	$name = $name.to_i
end

scheme = targets[$name] # Select scheme
dest = "#{scheme}--#{ALL_DIR}.ipa"
current_dir = "./fastlane/"
local_dir = "App/ElbT/"
dest_dir = "#{current_dir}#{local_dir}"


# Files uploaded by users
file_path = "'./#{local_dir}#{dest}'"
# puts file_path

    gym(scheme:scheme,
       export_method:"enterprise",
        output_directory: dest_dir,# file path
	output_name:dest)

puts "Enter your email address :\n"
$email_name = STDIN.gets
$email_name = $email_name.chomp

puts "The email address you entered is :#{$email_name}\n"

puts "Enter your email password :\n"
$email_password = STDIN.gets
$email_password = $email_password.chomp
puts "The password you entered is :#{$email_password}\n"

$command = "python semail.py #{$email_name#} {$email_password} #{file_path}"
puts "About to send mail ~> #{$command}"
puts "To send please enter :1\n"
$commit = STDIN.gets
$commit = $commit.chomp
if $commit.to_i == 1 then
    # Send email
    exec "# {$command}"
    # perform local cleanup delete
        exec "rm -rf rm -rf App"


end
  end
end

Copy the code

Python script for sending emails

! [](https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/1/29/168975b8f6~tplv-t2oaga2asx-image.imagefc132a? w=874&h=350&f=png&s=67647)Copy the code

File configuration structure:

Confirm after packing

Sending files by email

Please find the result