Cocoapods support Token authentication.
First you need to get the token from the password field ~/.netrc . After calling pod register you will see a section that looks like this:
machine trunk.cocoapods.org login user@example.com password 0000000011111111
Then you can upgrade podspec to CI using Token (which is unsafe):
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
Now you can set the environment variable directly in your plan settings. If you disable Display value in the build log (which is disabled by default), it treats it as a safe variable. This way, you donβt have to bother with Travis command-line tools or add unwanted files to your yaml file, or make changes without changing your repo.

source share