Toggle Dark

Pedro Piñera

Toggle Dark
Software Engineer at Shopify 🛍. I like building tools for developers and doing open source.
Mostly doing Ruby & Swift, and sometimes Javascript
Journal 📝

Install the last Carthage version on CI services (Travis, Circle, ...)

I've lately been working with multiple libraries and integrating them with CI, in particular Travis-CI because these libraries are Open Source. These libraries have dependencies that are resolved and built using Carthage which is distributed through Github Releases and Brew. However, the version in brew does not always match the last version available on Github Releases and your CI providers don't offer the last version either. What can you do then?. Get the last version from Github and install it with a very simple script, how?:

#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "Carthage version required (e.g. 0.11)"
exit 1
fi
curl -OlL "https://github.com/Carthage/Carthage/releases/download/$1/Carthage.pkg"
sudo installer -pkg "Carthage.pkg" -target /
rm "Carthage.pkg"
view raw gistfile1.txt hosted with ❤ by GitHub

Use that bash script passing as argument the version of Carthage that you want to install. It'll download the last .pkg available and install it. For example, if we wanted to use it in our .travis.yml script:

language: objective-c
notifications:
email: false
xcode_project: SugarRecord.xcodeproj
osx_image: xcode7.2
before_install:
- bash update_carthage.sh 0.11

Short but useful! Enjoy coding