一、创建私有库
1、创建仓库
在gitlab上创建两个仓库,分别为索引库和代码库
索引库:https://gitlab.com/xxx/xxxspec.git
代码库:https://gitlab.com/xxx/xxxSDK.git
2.创建本地工程
pod lib create xxx
根据需要选项创建相应的项目
1.png
3.配置本地spec文件
Pod::Spec.new do |s|
s.name = 'xxx'
s.version = '0.1.0'
s.summary = '数学工具'
s.swift_version = '5.0'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://gitlab.com/xxx/xxxsdk.git'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'hi' => 'xxx@xx.com' }
s.source = { :git => 'https://gitlab.com/xxx/xxxSDK.git', :tag => s.version.to_s }
s.ios.deployment_target = '12.0'
s.source_files = 'xxx/Classes/**/*'
end
4.修改或添加源代码
在xxx/Classes目录下添加自己的代码
5.将本地代码上传至代码库
进入项目目录
cd existing_repo
关联远端代码库
git remote add origin https://gitlab.com/xxx/xxxSDK.git
修改名称
git branch -M main
提交远端代码库
git push -uf origin main
提交代码
git add .
git commit -m "提交信息"
git push -uf origin main
添加tag
git tag -a '版本号' -m '提交信息'
推送tag
git push --tags
6.添加远端索引库至本地
pod repo add xxx https://gitlab.com/xxx/xxxspec.git
7.将代码库和索引库关联
cd 至本地代码库中spec文件所在文件夹
pod repo push xxx xxxSDK.podspec --verbose --use-libraries --allow-warnings
至此,私有库制作完成
二、库的更新
1.更新本地代码及更新pesc中版本号后提交至代码库
git add .
git commit -m "提交信息"
git push -uf origin main
添加tag
git tag -a '版本号' -m '提交信息'
推送tag
git push --tags
2.推送pesc至索引库
cd 至本地代码库中spec文件所在文件夹
pod repo push xxx xxxSDK.podspec --verbose --use-libraries --allow-warnings
至此,库更新完成