In the world of programs, many programs are actually produced because of the author’s own ‘lazy’ reasons, so I made a program, convenient for yourself and convenient for everyone. When you’re doing componentization, you’ve certainly experienced the hassle of publishing specs. There are a lot of ways to commit git and release it to your own private repository by command. Is there a way to automatically execute all the statements you want by executing a single statement? The answer is definitely there! That’s where Fastlane comes in. An automated tool that helps package different channels for Android or iOS, etc. Let’s see how fastlane automates publishing our lib to our own private repository.

Fastlane installation

brew cask install fastlane

The installation is as simple as using this single command. If brew is not installed, you can install it by yourself

This command creates a fastlane folder in our root directory, which contains AppFile, Fastfile, etc. This folder is used to package ipA packages. So we don’t need to execute this command here. We just need to know its directory structure

The Fastfile file is ready

If we did not execute the Fastlane init command, we need to create a folder fastlane in the root directory, and then create a Fastfile file in the folder

Directory structure as shown below:

Fastfile file preparation

This file simply puts together the actions that Fastlane officials have already made to implement the functionality we want. Actions

Desc "release the Spec by YTOSpec command automation" lane: FOFSpecRelease do | options | tag_version = options [: tag] target = options [: target] repoName = options[:repo] #pod install cocoapods( clean: true, podfile: "./Example/#{target}" ) #pod lib lint pod_lib_lint(verbose: true,allow_warnings: true) version_bump_podspec(path: Git add. Git_add #2, git commit git_commit(path: Git tag add_git_tag(tag: "#{tag_version}") push_to_git_remote(remote: "origin", # optional, default: "origin" local_branch: "master", # optional, aliased by "branch", default: "master" remote_branch: "master", # optional, default is set to local_branch force: false, # optional, default: false tags: true # optional, default: true ) pod_push(path: "#{target}.podspec", repo: "#{repoName}",allow_warnings: true) endCopy the code

All of these commands are explained on the website, and there are many other powerful actions on the website that are still a bit problematic. When we tag, if the tag already exists, we have to manually delete the tag to continue. Check whether there is a corresponding Action for the tag but no Action to remove the tag, so we need to define a custom Action