Dov Dov - 12 days ago 5
Git Question

Publishing to CocoaPods from Travis

How would you go about pushing to CocoaPods from Travis? I would like for each tagged commit to do a

pod trunk push
, but is it a good idea to
pod trunk register
Travis? Trunk's docs say it registers a machine, rather than a user, so would that inadvertently open up the Pod to pushes from other people who use Travis?

Does anyone have an example of a repo that's already doing this?

You can do this with RubyGems using private API keys pushed with the Travis command line tool, as described in RubyGems Deployment.

Answer

Cocoapods support authenticated with Token.

First, you need get Token in password field of ~/.netrc after pod register

machine trunk.cocoapods.org
   login user@example.com
   password 0000000011111111

Then you can upload podspec on CI with the Token

export COCOAPODS_TRUNK_TOKEN=0000000011111111
pod trunk push path/to.podspec

You can also encrypted the Token in Travis-CI with

travis encrypt COCOAPODS_TRUNK_TOKEN=0000000011111111 --add env
Comments