How to publish new official pod version?

8.4k views Asked by At

Updating pod version fails

I am using Xcode 8.2.1 and CocoaPods v1.1.1 and my code is Swift 3

My issue is with publishing new version of my pod or updating existing version, which fails on pod spec lint.

I've created a PlaybuzzSDK pod and I would like to update it's code. I commit and push the new code through GitHub client, but the changes are not reflected on the pod class, only on the Example project.

What did I do?

I've created new tag and tried to push it, but didn't pass validation:

git tag 0.1.1 (successful)
git push origin 0.1.1 (successful)
pod spec lint PlaybuzzSDK.podspec (unsuccessful with error below)
pod trunk push PlaybuzzSDK.podspec  (unsuccessful with error below) 

-> PlaybuzzSDK (0.1.1) - ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone https://github.com/LudaFuxPlaybuzz/playbuzz-ios-sdk.git /var/folders/h0/knhpn8z16n3cz6tkny5rmtn00000gn/T/d20161228-47834-nli8c4 --template= --single-branch --depth 1 --branch v0.1.1

Cloning into '/var/folders/h0/knhpn8z16n3cz6tkny5rmtn00000gn/T/d20161228-47834-nli8c4'... warning: Could not find remote branch v0.1.0 to clone. fatal: Remote branch v0.1.0 not found in upstream origin ) during validation.

[!] The spec did not pass validation, due to 1 error. [!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a .swift-version file to set the version for your Pod. For example to use Swift 2.3, run: echo "2.3" > .swift-version.

Additional things I've tried:

  • I removed the project from my comp and cloned it again
  • I've cleaned cache of CocoaPods rm -rf ~/Library/Caches/Cocoapods rm -rf ~/.cocoapods/repos
  • I've tried to create a new branch and tried to pod lint the branch.

But I get this error every time.

What did I expect to happen

I expected that from now on, if somebody adds

pod 'PlaybuzzSDK' 

and will update their pods, they'll get the new version

New version means that reloadItem will have the following signature:

public func reloadItem(_ itemAlias:String,
                         companyDomain: String,
                         showItemInfo:Bool)

What happened instead

I can't get through the pod lint. And when I update pod from example project, the function reloadItem gets back to

public func reloadItem(_ userID: String,
                    itemAlias:String,
                    showRecommendations: Bool,
                    showShareButton: Bool,
                    showFacebookComments: Bool,
                    showItemInfo: Bool,
                    companyDomain: String)

Project that demonstrates the issue

https://github.com/LudaFuxPlaybuzz/playbuzz-ios-sdk

2

There are 2 answers

7
Tj3n On BEST ANSWER

Summary, to update a pod:

  1. Update the version and the tag in podspec beforehand
  2. Commit, push code to git
  3. Create new tag with the current code, make sure it's the same tag as the one in podspec

    git tag 0.1.1

    git push origin 0.1.1

  4. Call pod spec lint to check and pod trunk push to update it on repo master list

    pod lib lint YourSDK.podspec

    pod trunk push YourSDK.podspec

It appears that your podfile is using the tag v0.1.1, however the tag in your repository is 0.1.1 without the v. This would also cause linting to fail.

1
Dave Lyon On

You need to add a file called .swift-version to the top level of your repository in order to have your users projects configured correctly when the pod is installed.

In the top level of your project, run this command:

echo "3.0" > .swift-version

Then commit that and update your tag to that commit.

It also appears that your podfile is using the tag v0.1.1, however the tag in your repository is 0.1.1 without the v. This would also cause linting to fail.