如何发布自己的开源框架到CocoaPods

一、前往GitHub创建自己的项目

如何发布自己的开源框架到CocoaPods_第1张图片
417D9FEE-8FEF-4DDC-B2A5-C138250D22FE.png

二、clone到本地

git clone https://github.com/UniverseJun/XXXXXXX.git

三、终端进入目录创建podspec文件

pod spec create ZJAlertView

四、打开podspec文件(MacDown、sublime等)

Pod::Spec.new do |s|

  s.name         = "ZJAlertView"
  s.version      = "0.0.1"
  s.summary      = "A custom subassembly."
  s.description  = <<-DESC
                        A custom subassembly A custom subassembly A custom subassembly
                   DESC

  s.homepage     = "https://github.com/UniverseJun/ZJAlertView"

  s.license      = "MIT"
  s.license      = { :type => "MIT", :file => "LICENSE" }
  s.author             = { "姓名" => "邮箱" }
  s.platform     = :ios
  s.source       = { :git => "https://github.com/UniverseJun/ZJAlertView.git", :tag => "0.0.1" }

  s.source_files  = "Classes", "ZJAlertView/**/*.{h,m}"
  s.exclude_files = "Classes/Exclude"

  s.public_header_files = "ZJAlertView/**/*.h"
  s.requires_arc = true

end

五、为Pod添加版本号

set the new version to 0.0.1
set the new tag to 0.0.1

六、验证

pod lib lint 
pod lib lint ZJAlertView.podspec --no-clean  在有提示使用 --no-clean的情况下使用

验证成功提醒

-> ZJAlertView (0.0.1)
ZJAlertView passed validation.

七、提交到github仓库

git add -A && git commit -m "提交注释"
git tag '0.0.1'
git push --tags
git push origin master

八、提交到cocoapods

1、注册trunk

pod trunk register [email protected] "作者名" --verbose

2、进邮箱验证
3、验证注册成功

pod trunk me
 - Name:     XXXX
 - Email:    [email protected]
 - Since:    May 18th, 20:47
 - Pods:
   - ZJAlertView
 - Sessions:
 - May 18th, 20:47 - September 23rd, 21:40. IP: 000.000.000.201

4、发布

pod trunk push xxx.podspec --verbose

九、搜索

pod search ZJAlertView

祝你们成功 ! ! !

你可能感兴趣的:(如何发布自己的开源框架到CocoaPods)