Freunde reagieren auf Native und Fastlane

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


Diejenigen unter Ihnen, die sich mindestens einmal für ein solches Thema interessiert haben, sind mehr als einmal auf Fastlane gestoßen - ein äußerst nützliches Dienstprogramm, das das Problem der Automatisierung von Builds und der Veröffentlichung von Anwendungen löst.


Es gibt eine große Anzahl von Artikeln und Videos, die den Vorteil der automatisierten Zusammenstellung des Projekts detailliert beschreiben, und der Inhalt dieser Artikel in Bezug auf React Native (jedoch auf eine andere plattformübergreifende Plattform) wird auf die folgenden Aktionen reduziert:


  1. Initialisieren Sie Fastlane in iOS- und Android-Ordnern
  2. Kopieren Sie die plattformspezifischen Skripttypen: clean, build,publish
  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 ( ).




Das Projekt wird gerade aktiv abgeschlossen und freut sich über Ihre Pull-Anfragen, Probleme oder zumindest Kommentare.
Wir hoffen, dass es für andere als uns nützlich ist oder uns ermutigt, flexiblere Lösungen zu schreiben.


All Articles