Publishing to CocoaPods from Travis

Cocoapods support authentication with a Token.

First, you need get the Token from the password field of ~/.netrc. After calling pod trunk register, you'll see a section that looks like this:

machine trunk.cocoapods.org
   login [email protected]
   password 0000000011111111

Then you can update podspec on CI with the Token (which is insecure):

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

You can also encrypt the Token in Travis-CI with

travis encrypt COCOAPODS_TRUNK_TOKEN=0000000011111111 --add env

Update

You can now set environment variable directly in your plan's Settings. If you turn off Display value in build log (which is disabled by default), it treats it as a secure variable. That way, you don't need to mess with the Travis command line tools, or add junk to your yaml file, and can make changes without altering your repo.

Travis environment variables