Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lexrus
Forked from hiroshi/Makefile
Created March 30, 2012 08:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lexrus/2250070 to your computer and use it in GitHub Desktop.
Save lexrus/2250070 to your computer and use it in GitHub Desktop.
Makefile for Testflight upload
# Testflight web interface doesn't allow input non-ASCII characters (e.g. Japanese) with Safari!
BROWSER = Safari
TESTFLIGHT_TEAM_TOKEN_FILE = ./.testflight_team_token
TESTFLIGHT_TEAM_TOKEN_URL = https://testflightapp.com/dashboard/team/edit/?next=/api/doc/
TESTFLIGHT_TEAM_TOKEN = $(shell cat $(TESTFLIGHT_TEAM_TOKEN_FILE))
TESTFLIGHT_API_TOKEN_FILE = ~/.testflight_api_token
TESTFLIGHT_API_TOKEN_URL = https://testflightapp.com/account/\#api-token
TESTFLIGHT_API_TOKEN = $(shell cat $(TESTFLIGHT_API_TOKEN_FILE))
TESTFLIGHT_NOTES = 'This build was uploaded via the upload API'
#TESTFLIGHT_OTHER_OPTIONS = -F replace=True
CODE_SIGN_IDENTITY_FILE = ./.code_sign_identity
CODE_SIGN_IDENTITY ?= $(shell cat "$(CODE_SIGN_IDENTITY_FILE)")
APP_PATH_FILE = ./.app_path
APP = $(shell cat "$(APP_PATH_FILE)")
APP_NAME = $(shell basename "$(APP)")
IPA = $(shell pwd)/$(shell basename "$(APP)" .app).ipa
.PHONY: testflight archive run-script-phase post-archive
testflight: $(IPA) $(TESTFLIGHT_TEAM_TOKEN_FILE) $(TESTFLIGHT_API_TOKEN_FILE)
curl http://testflightapp.com/api/builds.json \
-F file=@"$(IPA)" \
-F api_token=$(TESTFLIGHT_API_TOKEN) \
-F team_token=$(TESTFLIGHT_TEAM_TOKEN) \
-F notes=$(TESTFLIGHT_NOTES) \
$(TESTFLIGHT_OTHER_OPTIONS) \
| ruby -rjson -e "puts JSON.parse(ARGF.read)['config_url'].sub(/complete/,'edit')" \
| xargs open -a "$(BROWSER)"
$(IPA): archive
xcrun -sdk iphoneos PackageApplication \
"$(APP)" \
-o "$(IPA)" \
--sign "$(CODE_SIGN_IDENTITY)"
archive:
xcodebuild -workspace "$(APP_NAME).xcworkspace" -scheme "$(APP_NAME)ADHOC" -sdk iphoneos clean archive
touch:
touch "$(TESTFLIGHT_TEAM_TOKEN_FILE)"
touch "$(TESTFLIGHT_API_TOKEN_FILE)"
touch "$(CODE_SIGN_IDENTITY_FILE)"
touch "$(APP_PATH_FILE)"
team:
open -a "$(BROWSER)" "$(TESTFLIGHT_TEAM_TOKEN_URL)"
@echo "*** BE SURE THAT YOU SELECT RIGHT TEAM ***"
@read -ep "Enter testflight team token: " token && echo $$token > $@
api:
open -a "$(BROWSER)" "$(TESTFLIGHT_API_TOKEN_URL)"
@read -ep "Enter testflight API token: " token && echo $$token > $@
run-script-phase:
echo $(CODE_SIGN_IDENTITY) > $(CODE_SIGN_IDENTITY_FILE)
post-archive:
echo $(ARCHIVE_PRODUCTS_PATH)/Applications/$(shell ls "$(ARCHIVE_PRODUCTS_PATH)"/Applications) > $(APP_PATH_FILE)
(cd $(dirname $(dirname $WORKSPACE_PATH)) && make post-archive)
make run-script-phase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment