Skip to content

Instantly share code, notes, and snippets.

@mmertsock
Last active July 16, 2018 08:57
Show Gist options
  • Save mmertsock/8359009 to your computer and use it in GitHub Desktop.
Save mmertsock/8359009 to your computer and use it in GitHub Desktop.
Helper script template for publishing podspecs to a private repository. Place the `publish_pod.sh` file in the root directory of your pod (the same directory as your podspec file). You should also have a working copy of your private Cocoapods pod repository. The path of the pods repo and the name of the pod need to be inserted into the script te…
set -e # http://stackoverflow.com/q/2870992/795339
podname=<TODO:NAME>
version=$(grep s.version $podname.podspec | head -1 | cut -d = -f 2 | cut -d '"' -f 2)
poddir=<TODO:ROOT DIRECTORY OF YOUR LOCAL PODS REPO>/$podname/$version
# This should print without any quote characters. Otherwise the script will break.
echo "Publishing $podname release $version..."
echo "The podspec file should be updated with a new version number. Going to commit."
git add -A && git commit -m "Release $version"
echo "Tagging: don't forget to tag as v$version on Github"
git tag "v$version"
echo "Pushing local pod changes"
git push --tags
echo
echo "Adding podspec to pod repo"
mkdir -p $poddir
cp $podname.podspec $poddir/$podname.podspec
pushd $poddir
echo "Committing new podspec"
git add -A && git commit -m "Release $version of $podname"
echo "Pushing local pod repo changes"
git push
popd
echo "Don't forget to push your changes."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment