How to get pod_push to work

fastlane
ios

#1

Prerequisites

  1. pod_push works on your local machine

Steps

  1. In Workflows -> Secrets -> Add New
  2. Call it COCOAPODS_TRUNK_TOKEN
  3. In terminal grep -s password ~/.netrc | awk '{print $2}' | pbcopy
  4. Paste the copied token as the value of COCOAPODS_TRUNK_TOKEN
  5. You should be good now

#2

Awesome, thanks for the guide @mennolovink!

Just a question: could you please share your Script you use to actually do the publishing? Might help a lot to other users who are just getting started with cocoapods publishing :slight_smile:


#3

Sure @viktorbenei.

I’m currently using this release lane:

lane :release do
	  releaseBranchName = git_branch

    unless releaseBranchName.partition('/').first == "release"
      raise "Incorrect branch, expected release branch".red
    end

    sh("git", "fetch")
    sh("git", "checkout", releaseBranchName)

    version = releaseBranchName.partition('/').last
  
    version_bump_podspec(path: "<<PROJECT_NAME>>.podspec", version_number: version)
    cocoapods(clean: true, podfile: "Example/Podfile", repo_update: true)

		scan()
		pod_lib_lint

		sh("git", "add", "-A")
		sh("git", "commit", "-m", "Bump version to #{version} [ci skip]")
    sh("git", "fetch")
		sh("git", "checkout", "master")
		sh("git", "merge", releaseBranchName)
		sh("git", "tag", version)
		sh("git", "push", "origin", "--tags", "master")
		sh("git", "checkout", "develop")
		sh("git", "merge", "master")
		sh("git", "push", "origin", "develop")

		pod_push

    github_release = set_github_release(repository_name: "<<REPOSITIORY_NAME>>",
                                        api_token: ENV["GITHUB_TOKEN"],
                                        name: version,
                                        tag_name: version,
                                        description: "[Closed Issues](<<GITHUB_LINK_TO_MILESTONE>>)",
                                        commitish: "master")
end

:point_up_2:I use this as part of the GitFlow branching scheme.

I make sure Bitrise triggers this lane on "release/*", that way when I push a branch that’s called release/2.2.1, my fastlane script will assume it needs to update everything to version 2.2.1.

Cheers, Menno


#4

Awesome, thanks @mennolovink! :slight_smile: