Skip to content

Instantly share code, notes, and snippets.

@Ashton-W
Created March 13, 2014 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ashton-W/9521888 to your computer and use it in GitHub Desktop.
Save Ashton-W/9521888 to your computer and use it in GitHub Desktop.
Alcatraz Makefile with check for xcpretty install
ARCHIVE = "Alcatraz.tar.gz"
BUNDLE_NAME = "Alcatraz.xcplugin"
VERSION_LOCATION = "Alcatraz/ATZVersion.h"
INSTALL_PATH = ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/${BUNDLE_NAME}/
DEFAULT_BUILD_ARGS = -workspace TestProject/TestProject.xcworkspace -scheme TestProject
XCODEBUILD = xcodebuild $(DEFAULT_BUILD_ARGS)
VERSION = $(shell grep 'ATZ_VERSION' Alcatraz/ATZVersion.h | cut -d " " -f 3 | tr -d '"')
XCPRETTY_INSTALLED = $(shell which xcpretty)
ifneq ($(strip $(XCPRETTY_INSTALLED)),)
$(info Using xcpretty)
XCPRETTY = | xcpretty -c
XCPRETTY_TEST = | xcpretty -tc
endif
default: test
ci: clean ci_test
shipit: version build github_release push_deploy_branch
clean:
$(XCODEBUILD) clean $(XCPRETTY)
rm -rf build
# Run tests
ci_test:
set -o pipefail && $(XCODEBUILD) test $(XCPRETTY)
test:
set -o pipefail && $(XCODEBUILD) test | tee xcodebuild.log $(XCPRETTY_TEST)
# Merge changes into deploy branch
push_deploy_branch:
git fetch origin
ifeq ($(shell git diff origin/master..master),)
git checkout deploy
git reset --hard origin/master
git push origin deploy
git checkout -
else
$(error you have unpushed commits on the master branch)
endif
# Build archive ready for distribution
build: clean
xcodebuild -project Alcatraz.xcodeproj build
rm -rf ${BUNDLE_NAME}
cp -r ${INSTALL_PATH} ${BUNDLE_NAME}
mkdir -p releases/${VERSION}
tar -czf releases/${VERSION}/${ARCHIVE} ${BUNDLE_NAME}
rm -rf ${BUNDLE_NAME}
# Create a Github release
github_release:
git push
git push --tags
gh release create -m "Release ${VERSION}" ${VERSION}
# Set latest version
# Requires VERSION argument set
version: update_install_url
git add .
git commit -am "Bump version $(VERSION)"
git tag $(VERSION)
update_install_url:
sed -i '' -e 's/[.0-9]\{3,5\}/${VERSION}/' Scripts/install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment