朋友反应本机和Fastlane

https://habrastorage.org/webt/n8/lo/r5/n8lor5lkvnqev0xktqwxayrv1t0.png


至少曾经对此主题感兴趣的人中,不仅仅一次遇到Fastlane,这是一个非常有用的实用程序,解决了自动生成和发布应用程序的问题。


有大量的文章和视频详细描述了使用项目的自动组装的优势,并且这些文章的内容与React Native(但是,到另一个跨平台)的关系归结为以下操作:


  1. 在iOS和Android文件夹中初始化Fastlane
  2. 复制特定于平台的脚本类型:cleanbuildpublish
  3. iOS Android
  4. !

, , - . ,


  1. ?
    , ( , , ..). Fastfile , DRY?
  2. ?
    Ruby, Fastlane , Fastlane . JS , Ruby, , , .
  3. ?
    , , , Android. iOS Fastlane , Android . Ruby , Ruby , , .
  4. ?
    . , - , .

- Ruby API, . Android :


#      
import "../../scripts/Fastfile.rb"

lane :publish do |options|
  #       
  self.runner.current_platform = :android

  assert_git()
  assert_environment(env: options[:env])
  assert_credentials()

  new_version=increment_version(type: options[:increment])
  version_description=set_version(version: new_version)

  build(env: options[:env])

  upload(track: options[:track])

  commit(text: 'Up version to ' + new_version)
  commit_tag(text: 'android/' + new_version)
  push_all()

  message(text: '   "'+ app_name + '"   Google Play.   ' + options[:track].upcase + ' ' + version_description + url)
end

, build, Fastfile.rb. - : .


Ruby, , . React Native JS , , , Ruby. JS ! ( )


(, ) Fastlane, JS, . :


https://habrastorage.org/webt/vq/bi/pp/vqbippe_pkcckg5utfsdseb948a.gif


, .


:


import { android, gradle, AndroidPlatform, ui, supply, Incrementer } from "@lamantin/fastpush"

const androidPlatform = new AndroidPlatform()

const [oldVersionCode, newVersionCode] = await androidPlatform.incrementVersionCode()
ui.success(`Success update build [${oldVersionCode}] -> [${newVersionCode}]`)

android([
  gradle("clean"),
  gradle("assemble", {
    build_type: "Release",
  }),
  supply({ track: "beta" }),
])

( ), :


  • TypeScript ,
  • JS
  • , ,
  • 1 , . ios android Fastlane
  • ,

, , . , CLI , , :


https://habrastorage.org/webt/mf/2q/yy/mf2qyyzncnmxlbijlkctcl8lzwu.png


Github , .




yarn add @lamantin/fastpush --dev
# 
npm install @lamantin/fastpush --save-dev

, , - :


import { publish } from '@lamantin/fastpush/build/src/cli/publish'
import { fastpush, FastpushResult } from '@lamantin/fastpush/build/src/cli/fastpush'
import { git } from '@lamantin/fastpush/build/src/utils'
import Telegram from 'our-own-app/Telegram'

//    
const options: FastpushResult = fastpush(process.argv)

//     (   CLI),     
publish(options, {
  // onPostPublish - ,       
  onPostPublish: async (platform, [prevVersion, version], [prevBuild, build]) => {
    const store = platform.type === 'ios' ? 'App Store ' : 'Google Play '
    const message = `App "My App Name"  sended to ${store}, track ${options.track.toUpperCase()}.\\n Version: ${tag}`
    Telegram.sendMessage(message)    
  }
})

fastpush, , JS options, . , publish . , ( , ).


Flutter?


React Native, Flutter ( ).




该项目正在积极完成中,欢迎您提出请求,问题或至少提出意见。
我们希望它对我们以外的人有用,或者鼓励我们编写更灵活的解决方案。


All Articles