diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..4eb28bcb --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://gems.ruby-china.com" + +gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..d6644dd9 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,250 @@ +GEM + remote: https://gems.ruby-china.com/ + specs: + CFPropertyList (3.0.4) + rexml + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + admqr_knife (0.1.5) + api_tools + thor + api_tools (0.1.1) + multi_json + rest-client (~> 2.0) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.529.0) + aws-sdk-core (3.122.1) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-kms (1.51.0) + aws-sdk-core (~> 3, >= 3.122.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.105.1) + aws-sdk-core (~> 3, >= 3.122.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.4.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + chunky_png (1.4.0) + claide (1.0.3) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.4) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.6) + emoji_regex (3.2.3) + excon (0.88.0) + faraday (1.8.0) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + multipart-post (>= 1.2, < 3) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.5) + fastlane (2.197.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (~> 2.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-fir_cli (2.0.12) + fir-cli (~> 2.0.12) + fastlane-plugin-pgyer (0.2.2) + fir-cli (2.0.14) + CFPropertyList + admqr_knife (~> 0.1.5) + api_tools (~> 0.1.1) + rest-client (~> 2.0) + rexml + rqrcode (~> 0.7) + ruby_android_apk (~> 0.7.7.1) + thor (~> 0.19) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.13.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.1) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.8.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-playcustomapp_v1 (0.6.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.9.0) + google-apis-core (>= 0.4, < 2.a) + google-cloud-core (1.6.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.5.0) + faraday (>= 0.17.3, < 2.0) + google-cloud-errors (1.2.0) + google-cloud-storage (1.34.1) + addressable (~> 2.5) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.1) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.1.0) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-accept (1.7.0) + http-cookie (1.0.4) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.4.0) + json (2.6.1) + jwt (2.3.0) + memoist (0.16.2) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2021.0901) + mini_magick (4.11.0) + mini_mime (1.1.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.1) + netrc (0.11.0) + optparse (0.1.1) + os (1.1.4) + plist (3.6.0) + public_suffix (4.0.6) + rake (13.0.6) + representable (3.1.1) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + rqrcode (0.10.1) + chunky_png (~> 1.0) + ruby2_keywords (0.0.5) + ruby_android_apk (0.7.7.1) + rubyzip (>= 1.1.6) + rubyzip (2.3.2) + security (0.1.3) + signet (0.16.0) + addressable (~> 2.8) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thor (0.20.3) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8) + unicode-display_width (1.8.0) + webrick (1.7.0) + word_wrap (1.0.0) + xcodeproj (1.21.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-20 + +DEPENDENCIES + fastlane + fastlane-plugin-fir_cli + fastlane-plugin-pgyer + +BUNDLED WITH + 2.2.3 diff --git a/archive/Debug/fir-xplan-ios.png b/archive/Debug/fir-xplan-ios.png new file mode 100644 index 00000000..013a63c9 Binary files /dev/null and b/archive/Debug/fir-xplan-ios.png differ diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 00000000..18030630 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,6 @@ +# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app +# apple_id("[[APPLE_ID]]") # Your Apple email address + + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 00000000..5a495d74 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,264 @@ +# Customise this file, documentation can be found here: +# https://github.com/fastlane/fastlane/tree/master/fastlane/docs +# All available actions: https://docs.fastlane.tools/actions +# can also be listed using the `fastlane actions` command + +# Change the syntax highlighting to Ruby +# All lines starting with a # are ignored when running `fastlane` + +# If you want to automatically update fastlane if a new version is available: +# update_fastlane + +# This is the minimum version number required. +# Update this, if you use features of a newer version +fastlane_version "2.153.1" + +default_platform :ios + +#声明 +ENV["FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"] = "pnpm-livf-iqwt-vjxq" + +APP_NAME = "xplan-ios" +WORKSPACE = "xplan-ios.xcworkspace" +SCHEME = "xplan-ios" +IPA_NAME = "#{APP_NAME}.ipa" +START_DATE = Time.now.strftime('%Y-%m-%d %H:%M:%S %A') +START_TIME = Time.now +ENV_APPLESTORE = "" +CONFIGURATION = "Debug" # 默认是 Debug (可选 Release) +EXPORT_METHOD = "development" # 默认是 development (可选 ad-hoc,app-store) +OUTPUT_DIRECTORY = "./archive/#{CONFIGURATION}" # IPA 文件导出地址(符号表文件) + +platform :ios do + before_all do + + def colorize(text, color_code) + "\e[#{color_code}m#{text}\e[0m" + end + + def green(text); colorize(text, 32); end + def magenta(text); colorize(text, 35); end + def cyan(text); colorize(text, 36); end + + desc "project TuTu archive debug ipa to fir" + puts "" + magenta("====== 🚀🚀 project TuTu archive debug ipa to fir 🚀🚀 ======") + "" + puts "" + green("====== 🚀🚀 打包开始的时间为: #{START_DATE} ==== 🚀🚀 ======") + "" + + #1. 开始前的一些操作,如代码更新(git_pull) + + # git_pull # 拉取新代码 + # # cocoapods(repo_update:true) + # sh "pod update" + end + + # debug + desc "1. 发布iOS Dubug ipa 到 firim 网站" + lane :d do + + CONFIGURATION = "Debug" + EXPORT_METHOD = "development" + archiveAction + end + + # release + desc "2. 发布iOS Release ipa 到 firim 网站" + lane :r do + CONFIGURATION = "Release" + EXPORT_METHOD = "development" + + archiveAction + end + + # appstore + desc "3. 发布iOS Release ipa 到 苹果商店" + lane :store do + + ENV_APPLESTORE = "Apple Store" + CONFIGURATION = "Release" + EXPORT_METHOD = "app-store" # 默认是 development (可选 ad-hoc,app-store) + + archiveAction + end + + # archive + desc "4. 打包操作" + lane :archiveAction do + + #git_pull" # 拉取新代码 + # cocoapods(repo_update:true) + #sh "pod update" + + #自动增加build + updateProjectBuildNumber + + # 开始时间 + startDate = Time.now.strftime('%Y-%m-%d %H:%M:%S %A') + startTime = Time.now + puts "" + magenta("====== 🚀🚀 打包开始的时间为: #{startDate} ==== 🚀🚀 ======") + "" + + #gym配置,打包输出。 + + #fastlane gym --export_method ad-hoc + #fastlane gym --export_method enterprise + #fastlane gym --export_method app-store + #清除上一次的ipa文件 + #clean_ipafile + #导出路径 + # output_directory = "./archive/#{configuration}" + # 开始打包 + gym( + # 指定打包所使用的输出方式,目前支持app-store, package, ad-hoc, enterprise, development + export_method: EXPORT_METHOD, + export_xcargs: "-allowProvisioningUpdates", + workspace: WORKSPACE, + # 指定打包方式,Release 或者 Debug + configuration: CONFIGURATION, + # 指定scheme的名字 + scheme: SCHEME, + # 是否清空以前的编译信息 true:是 + clean:true, + # 指定输出文件夹,这里会保存我们最后生成的ipa文件 + output_directory: OUTPUT_DIRECTORY, + # 输出的ipa名称 + output_name: IPA_NAME + ) + + if ENV_APPLESTORE == "Apple Store" + #do Something + uploadAppleStore + else + #do Otherthing + uploadToFirim + end + + # 上传符号表 + #upload_dSYM + + # 统计结束时间 + endDate = Time.now.strftime('%Y-%m-%d %H:%M:%S %A') + endTime = Time.now + + # 输出打包开始时间 和 结束时间 + puts "" + magenta("====== 🚀🚀 打包执行开始的时间为: #{START_DATE} ==== 🚀🚀 ======") + "" + puts "" + magenta("====== 🚀🚀 打包执行结束的时间为: #{endDate} ==== 🚀🚀 ======") + "" + + # 输出总用时 + SECONDS = endTime - START_TIME + UI.message("执行完毕,用时" + cyan("#{SECONDS}") + "秒") + + end + + # 上传到 firim + desc "5. 执行上传操作" + lane :uploadToFirim do + puts "" + magenta("====== 🚀🚀 ==== 执行上传到 fir 的命令 ==== 🚀🚀 ======") + "" + # fir 的配置信息 + fir_cli api_token: "ed9d92c209718eb877522b2a716065ad", changelog: "Hello fir.im" + # pgyer(api_key: "d1b2989cde5da7909baa2e7677104a48", + # user_key: "fe25d4bc286baf919209843d9cb45da0", + # ipa: "#{OUTPUT_DIRECTORY}/#{IPA_NAME}") + # puts "" + magenta("====== 🚀🚀 ------ 上传到 蒲公英 成功, 请查看 ------- 🚀🚀 ======") + "" + # UI.message("下载地址为:#{firimUrlPath} ") + end + + # + desc "6. 发布到 Apple Store" + lane :uploadAppleStore do + + deliver(force: false, skip_screenshots: true, skip_metadata: true) + puts "" + magenta("====== 🚀🚀 ------ 上传到 Apple Store 成功, 请查看 ------- 🚀🚀 ======") + "" + + end + + # 用于更新 App 的 build Num 的方法 + desc "7. 用于更新 App 的 build Num 的方法" + lane :updateProjectBuildNumber do + + # 获取当前时间 + currentTime = Time.new.strftime("%Y%m%d") + # 获取当期版本号 + build = get_build_number() + + if build.include?"#{currentTime}" + # => 为当天版本 计算迭代版本号 + lastStr = build[build.length-2..build.length-1] + lastNum = lastStr.to_i + lastNum = lastNum + 1 + lastStr = lastNum.to_s + + if lastNum < 10 + lastStr = lastStr.insert(0,"0") + end + # 如果是当天的版本 格式为:2019122703 当天的年月日加上构建的次数 日期+build + build = "#{currentTime}#{lastStr}" + else + # => 非当天版本 build 号重置 + build = "#{currentTime}01" + end + UI.message("*************| " + magenta("更新 Build #{build}") + " |*************") + # => 更改项目 build 号 + increment_build_number( + build_number: "#{build}" + ) + + end + + desc "8. 上传符号表操作" + lane :upload_dSYM do + #上传符号表到 bugly + + bugly(app_id: "f80a6c7ccc", + app_key: "b3549e1a-11ae-40ed-8568-29b5b72c61a2", + symbol_type: 2, + bundle_id: "com.laihui.lookinglove", + product_version: "1.3.1", + channel: CONFIGURATION + ) + + end + + lane :resigh do + resign( + ipa: "/Users/gzlx/Desktop/HAYO 2020-04-09 16-56-30/HAYO.ipa", # can omit if using the `ipa` action + signing_identity: "Apple Development: yikai xu (67DUV395JB)", + provisioning_profile: "/Users/gzlx/Desktop/HYAO证书/adhoc-3.mobileprovision", # can omit if using the _sigh_ action + ) + end + + lane :review do + deliver( + ipa: "#{OUTPUT_DIRECTORY}/#{IPA_NAME}", + force: true, # Skip HTMl report verification + skip_metadata: true, + skip_screenshots: true + ) + end + + + # You can define as many lanes as you want + + after_all do |lane| + # This block is called, only if the executed lane was successful + + slack( + slack_url: "https://hooks.slack.com/services/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", + message: "Successfully deployed new App Update.", + payload: {"text": "{A very important thing has occurred! for details!"} + ) + end + + error do |lane, exception| + slack( + slack_url: "https://hooks.slack.com/services/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", + message: "打包失败了, 请查看原因", + success: false + ) + end +end + + +# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md +# All available actions: https://docs.fastlane.tools/actions + +# fastlane reports which actions are used +# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile new file mode 100644 index 00000000..bba2f22f --- /dev/null +++ b/fastlane/Pluginfile @@ -0,0 +1,6 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! + +gem 'fastlane-plugin-pgyer' +gem 'fastlane-plugin-fir_cli' diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 00000000..6937a7c5 --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,74 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew install fastlane` + +# Available Actions +## iOS +### ios d +``` +fastlane ios d +``` +1. 发布iOS Dubug ipa 到 firim 网站 +### ios r +``` +fastlane ios r +``` +2. 发布iOS Release ipa 到 firim 网站 +### ios store +``` +fastlane ios store +``` +3. 发布iOS Release ipa 到 苹果商店 +### ios archiveAction +``` +fastlane ios archiveAction +``` +4. 打包操作 +### ios uploadToFirim +``` +fastlane ios uploadToFirim +``` +5. 执行上传操作 +### ios uploadAppleStore +``` +fastlane ios uploadAppleStore +``` +6. 发布到 Apple Store +### ios updateProjectBuildNumber +``` +fastlane ios updateProjectBuildNumber +``` +7. 用于更新 App 的 build Num 的方法 +### ios upload_dSYM +``` +fastlane ios upload_dSYM +``` +8. 上传符号表操作 +### ios resigh +``` +fastlane ios resigh +``` + +### ios review +``` +fastlane ios review +``` + + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).