Last active
September 2, 2017 07:45
-
-
Save micky2be/f1d7f107e6984d8d4b1b7160ec280751 to your computer and use it in GitHub Desktop.
Makefile for Cordova publish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPTS = ./scripts | |
RESOURCES = ./resources | |
BIN = ${shell npm bin} | |
JSDOC = $(BIN)/jsdoc | |
null := | |
SPACE := $(null) $(null) | |
# Configuration: Git releases | |
GIT_RELEASE_REMOTE ?= upstream | |
GIT_RELEASE_BRANCH ?= master | |
# Configuration: iTunes Connect | |
IOS_ITUNES_APP_ID ?= 123456789 | |
# Configuration: Google Play | |
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_KEY ?= | |
GOOGLE_PLAY_TRACK ?= alpha | |
# Help | |
# ---- | |
define helpStarting | |
@echo "Getting started:" | |
@echo | |
@echo " make help Prints this help." | |
@echo " make info Prints information about Cordova and available build systems." | |
@echo " make info-ipa Prints information about the last built iOS IPA file." | |
@echo | |
endef | |
define helpSigning | |
@echo "Signing:" | |
@echo | |
@echo " make download-ios-prov-profiles Downloads the required provisioning profiles from Apple Dev Center (requires: ios login)." | |
@echo | |
endef | |
define helpDistribution | |
@echo "Distribution:" | |
@echo | |
@echo " make distribute-ios-device Archives and installs the iOS build onto a connected iOS device." | |
@echo " make distribute-ios-itunes Archives and uploads the iOS build to iTunes Connect." | |
@echo " make distribute-ios-hockeyapp Archives and uploads the iOS build to HockeyApp." | |
@echo " make distribute-android-device Installs the iOS build onto a connected Android device." | |
@echo " make distribute-android-googleplay Uploads the Android build to Google Play." | |
@echo " make distribute-android-hockeyapp Uploads the Android build to HockeyApp." | |
@echo | |
endef | |
define helpConfiguration | |
@echo "Configuration:" | |
@echo | |
@echo " You can override a number of settings by setting environment variables. Some of these variables already" | |
@echo " have default values. Please run 'make info' to inspect the state of the environment, and to see all" | |
@echo " variable names that you can override." | |
@echo | |
endef | |
.PHONY: help | |
help: | |
@echo | |
$(helpStarting) | |
$(helpSigning) | |
$(helpDistribution) | |
$(helpConfiguration) | |
# Assertion functions | |
# ------------------- | |
define dexists | |
$(if $(shell test -d "$(1)" && echo 1),,$(error $(or $(2),Directory not found: $(1)))) | |
endef | |
define fexists | |
$(if $(shell test -f "$(1)" && echo 1),,$(error $(or $(2),File not found: $(1)))) | |
endef | |
define assert | |
$(if $(1),,$(error $(2))) | |
endef | |
define assertCleanGit | |
$(if $(realpath .git),$(if $(shell "$(call run,GIT)" diff --quiet --exit-code && echo 1),,$(error You have uncommitted changes)),) | |
endef | |
define assertGitBranch | |
$(if $(shell [ $$("$(call run,GIT)" symbolic-ref --short HEAD -q) == "$(1)" ] && echo 1),,$(error You must be on the "$(1)" branch)) | |
endef | |
# Pretty printing | |
define echoVar | |
$(if $($(1)),$($(1)) (from $(1)),please set $(1)) | |
endef | |
define echoConst | |
$(or $($(1)),could not be detected) | |
endef | |
define echoPassword | |
$(if $($(1)),configured,please set $(1)) | |
endef | |
# Dependency resolving | |
# -------------------- | |
NPM_BIN = ${shell npm bin} | |
AWK_EXE = awk | |
AWK_ERR = Please install $(AWK_EXE) | |
DEFAULTS_EXE = defaults | |
DEFAULTS_ERR = Could not find the "$(DEFAULTS_EXE)" utility | |
PLIST_BUDDY_EXE = /usr/libexec/PlistBuddy | |
PLIST_BUDDY_ERR = Could not find the "$(PLIST_BUDDY_EXE)" utility | |
SECURITY_EXE = security | |
SECURITY_ERR = Could not find the "$(SECURITY_EXE)" utility | |
OPENSSL_EXE = openssl | |
OPENSSL_ERR = Could not find OpenSSL | |
IPA_EXE = ipa | |
IPA_ERR = Please install Shenzhen from https://github.com/nomad/Shenzhen | |
PUCK_EXE = puck | |
PUCK_ERR = Please install HockeyApp client and set up the "puck" CLI from http://support.hockeyapp.net/kb/services-webhooks-desktop-apps/how-to-upload-to-hockeyapp-on-a-mac#installation | |
IOS_EXE = ios | |
IOS_ERR = Please install Cupertino from https://github.com/nomad/cupertino | |
GOOGLE_PLAY_PUBLISHER_EXE = $(NPM_BIN)/google-play-publisher | |
GOOGLE_PLAY_PUBLISHER_ERR = Please install the publication software for Google Play (npm install google-play-publisher) | |
XCODEBUILD_EXE = xcodebuild | |
XCODEBUILD_ERR = Please install Xcode and xcodebuild | |
CORDOVA_EXE = $(NPM_BIN)/cordova | |
CORDOVA_ERR = Please install npm dependency (eg: npm install cordova) | |
CORDOVA_ANDROID_EXE = platforms/android/cordova/build | |
CORDOVA_ANDROID_ERR = Please install the cordova platform android (cordova platform add android) | |
IOS_DEPLOY_EXE = $(NPM_BIN)/ios-deploy | |
IOS_DEPLOY_ERR = Please install the npm package ios-deploy (eg: npm install ios-deploy) | |
ADB_EXE = $(if $(ANDROID_SDK_PATH),$(wildcard $(ANDROID_SDK_PATH)/platform-tools/adb),) | |
ADB_ERR = Please install the Android SDK and set the ANDROID_SDK_PATH environment variable to its installed location | |
AAPT_EXE = $(if $(ANDROID_SDK_PATH),$(wildcard $(ANDROID_SDK_PATH)/build-tools/*/aapt),) | |
AAPT_ERR = Please install the Android SDK and set the ANDROID_SDK_PATH environment variable to its installed location | |
GIT_EXE = git | |
GIT_ERR = Please install git (eg: brew install git) | |
NPM_EXE = git | |
NPM_ERR = Please install npm (eg: brew install npm) | |
define run | |
$(or $(shell command -v "$($(1)_EXE)"),$(error "$($(1)_ERR)")) | |
endef | |
define try | |
$(or $(shell command -v "$($(1)_EXE)"),$(warning "$($(1)_ERR)")) | |
endef | |
define xresolve | |
$(shell command -v "$($(1)_EXE)") | |
endef | |
# Set up paths | |
# ------------ | |
BUILD_PATH = platforms | |
BUILD_PATH_IOS = $(BUILD_PATH)/ios | |
BUILD_PATH_ANDROID = $(BUILD_PATH)/android | |
LOG = $(CURDIR)/build.log | |
# Detect application paths and versions through the system profiler (run only once) | |
define detectApps | |
$(shell "$(call run,XCODEBUILD)" -version | "$(call run,AWK)" 'BEGIN {ORS="@@@"}; \ | |
/^Xcode/ { sub(/^ +Xcode [ a-zA-Z]*/, ""); version = $$0 } \ | |
/^Build/ { sub(/^ +Build version */, ""); version "\t" $$0 }') | |
endef | |
# Cordova | |
BUNDLE_ID := $(shell "$(call run,AWK)" '/^<widget id=/ ' config.xml | sed 's|.*id="\([^"]*\).*|\1|') | |
BUNDLE_VERSION = $(shell "$(call run,AWK)" '/^<widget / ' config.xml | sed 's|.*version="\([^"]*\).*|\1|') | |
# subst is escaping spaces (` ` by `\ `) in the BUNDLE_NAME | |
BUNDLE_NAME := $(subst $(SPACE),\ ,$(shell "$(call run,AWK)" '/^ *<name>/ ' config.xml | sed 's|. *<name>\([^"]*\)</name>|\1|')) | |
# Android | |
ANDROID_SDK_PATH ?= $(ANDROID_HOME) | |
ANDROID_ARCHIVE_PATH = $(BUILD_PATH_ANDROID)/build/outputs/apk | |
ANDROID_ARCHIVE_PATH_DEBUG = android-armv7-debug.apk | |
ANDROID_ARCHIVE_PATH_RELEASE = android-armv7-release.apk | |
ANDROID_ARCHIVE_NAME_DEVICE = android-device | |
ANDROID_ARCHIVE_NAME_GOOGLE = android-google | |
ANDROID_ARCHIVE_NAME_HOCKEY = android-hockey | |
# iOS | |
IOS_PROV_PROFILES_DIR = $(HOME)/Library/MobileDevice/Provisioning Profiles | |
IOS_ARCHIVE_PATH_DEVICE = $(BUILD_PATH_IOS)/build/$(BUNDLE_NAME)-Device | |
IOS_ARCHIVE_PATH_ITUNES = $(BUILD_PATH_IOS)/build/$(BUNDLE_NAME)-iTunes | |
IOS_ARCHIVE_PATH_HOCKEY = $(BUILD_PATH_IOS)/build/$(BUNDLE_NAME)-HockeyApp | |
IOS_DEV_PROFILE_PATH = $(shell profPath=""; \ | |
if [ -d "$(IOS_PROV_PROFILES_DIR)" ]; then \ | |
for file in "$(IOS_PROV_PROFILES_DIR)"/*.mobileprovision; do \ | |
if [ ! -f "$$file" ]; then continue; fi; \ | |
data=$$("$(call run,SECURITY)" cms -D -i "$$file"); \ | |
"$(call run,PLIST_BUDDY)" -c "Print ProvisionedDevices" /dev/stdin <<< $$data &> /dev/null || continue; \ | |
id=$$("$(call run,PLIST_BUDDY)" -c "Print Entitlements:application-identifier" /dev/stdin <<< $$data | cut -d\. -f2-); \ | |
if [ "$$id" = "$(BUNDLE_ID)" ]; then profPath="$$file"; break; fi; \ | |
if [ "$$id" = "*" ]; then profPath="$$file"; fi; \ | |
done; \ | |
fi; \ | |
echo "$$profPath") | |
IOS_PROD_PROFILE_PATH = $(shell profPath=""; \ | |
if [ -d "$(IOS_PROV_PROFILES_DIR)" ]; then \ | |
for file in "$(IOS_PROV_PROFILES_DIR)"/*.mobileprovision; do \ | |
if [ ! -f "$$file" ]; then continue; fi; \ | |
data=$$("$(call run,SECURITY)" cms -D -i "$$file"); \ | |
"$(call run,PLIST_BUDDY)" -c "Print ProvisionedDevices" /dev/stdin <<< $$data &> /dev/null && continue; \ | |
id=$$("$(call run,PLIST_BUDDY)" -c "Print Entitlements:application-identifier" /dev/stdin <<< $$data | cut -d\. -f2-); \ | |
if [ "$$id" = "$(BUNDLE_ID)" ]; then profPath="$$file"; break; fi; \ | |
done; \ | |
fi; \ | |
echo "$$profPath") | |
define getProfileName | |
$(if $(1),$(shell "$(call try,PLIST_BUDDY)" -c "Print Name" /dev/stdin <<< $$("$(call try,SECURITY)" cms -D -i "$(1)" 2> /dev/null) 2> /dev/null),) | |
endef | |
define getProfileUuid | |
$(if $(1),$(shell "$(call try,PLIST_BUDDY)" -c "Print UUID" /dev/stdin <<< $$("$(call try,SECURITY)" cms -D -i "$(1)" 2> /dev/null) 2> /dev/null),) | |
endef | |
define getSignIdentityFromProfile | |
$(if $(1),$(shell "$(call try,PLIST_BUDDY)" -c "Print DeveloperCertificates:0" /dev/stdin <<< $$("$(call try,SECURITY)" cms -D -i "$(1)" 2> /dev/null) 2> /dev/null | "$(call try,OPENSSL)" x509 -subject -inform der 2> /dev/null | head -1 | sed 's|.*CN=\([^/]*\).*|\1|'),) | |
endef | |
define describeSignIdentity | |
$(if $(1),$(shell $(call try,SECURITY) find-certificate -c "$(1)" > /dev/null 2>&1 && echo "$(1)" || echo "$(1) (not installed)"),) | |
endef | |
# Information providers | |
# --------------------- | |
.PHONY: echo info info-ipa | |
echo: | |
@echo "$($(var))" | |
info: | |
@echo | |
@echo "Project:" | |
@echo " Project: $(call echoConst,BUNDLE_NAME)" | |
@echo " Path: $(CURDIR)" | |
@echo " Bundle ID: $(call echoConst,BUNDLE_ID)" | |
@echo " Bundle Version: $(call echoConst,BUNDLE_VERSION)" | |
@echo | |
@echo "Applications:" | |
@echo " Android:" | |
@echo " SDK path: $(call echoVar,ANDROID_SDK_PATH)" | |
@echo | |
@echo "Signing:" | |
@echo " iOS:" | |
@echo " Production:" | |
@echo " Provisioning profile: $(or $(call getProfileName,$(IOS_PROD_PROFILE_PATH)),not found)" | |
@echo " Code signing identity: $(or $(call describeSignIdentity,$(call getSignIdentityFromProfile,$(IOS_PROD_PROFILE_PATH))),could not extract from provisioning profile)" | |
@echo | |
@echo " Development:" | |
@echo " Provisioning profile: $(or $(call getProfileName,$(IOS_DEV_PROFILE_PATH)),not found)" | |
@echo " Code signing identity: $(or $(call describeSignIdentity,$(call getSignIdentityFromProfile,$(IOS_DEV_PROFILE_PATH))),could not extract from provisioning profile)" | |
@echo | |
@echo " Android:" | |
@echo " Keystore path: $(call echoVar,ANDROID_KEYSTORE_NAME)" | |
@echo " Keystore password: $(call echoPassword,ANDROID_KEYSTORE_PASSWORD)" | |
@echo " Key alias name: $(call echoVar,ANDROID_KEYALIAS_NAME)" | |
@echo " Key alias password: $(call echoPassword,ANDROID_KEYALIAS_PASSWORD)" | |
@echo | |
@echo "Distribution:" | |
@echo " iOS:" | |
@echo " iTunes Connect:" | |
@echo " App ID: $(call echoVar,IOS_ITUNES_APP_ID)" | |
@echo | |
@echo " HockeyApp:" | |
@echo " App ID: $(call echoVar,IOS_HOCKEYAPP_APP_ID)" | |
@echo " API token: $(call echoPassword,IOS_HOCKEYAPP_API_TOKEN)" | |
@echo | |
@echo " Android:" | |
@echo " Google Play:" | |
@echo " Service Account JSON key file: $(call echoVar,GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_KEY)" | |
@echo " Track: $(call echoVar,GOOGLE_PLAY_TRACK)" | |
@echo | |
@echo " HockeyApp:" | |
@echo " App ID: $(call echoVar,ANDROID_HOCKEYAPP_APP_ID)" | |
@echo " API token: $(call echoPassword,ANDROID_HOCKEYAPP_API_TOKEN)" | |
@echo | |
define infoIpa | |
@echo | |
@echo "$(1):" | |
@echo "$$(du -h "$(1)" | cut -f1) ($$(du -k "$(1)" | cut -f1) KB)" | |
@$(call run,IPA) info "$(1)" | |
endef | |
info-ipa: | |
$(or $(foreach ipa,$(wildcard $(BUILD_PATH_IOS)/*.ipa),$(call infoIpa,$(ipa))),$(error No IPA bundle file could be found (build a bundle, or run a distribution first))) | |
# Open tools | |
# ---------- | |
.PHONY: open-android open-xcode | |
open-android: | |
"$(call run,ANDROID)" -projectPath "$(CURDIR)" | |
open-xcode: | |
"$(call run,XCODE)" "$(BUILD_PATH_IOS)" | |
# Cordova build operations | |
# ---------------------- | |
CORDOVA_SOURCE_FILES := $(shell find www plugins hooks res -type f && find config.xml | "$(call run,AWK)" '{ gsub(/ /, "?"); print; }') | |
$(CORDOVA_SOURCE_FILES): | |
define cordovaPrepare | |
"$(call run,CORDOVA)" prepare $(1) | |
endef | |
define cordovaCompile | |
"$(call run,CORDOVA)" compile $(1) | |
endef | |
define cordovaBuild | |
"$(call run,CORDOVA)" build $(1) | |
endef | |
$(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj: $(CORDOVA_SOURCE_FILES) | |
# $(call cordovaPrepare,ios) | |
@echo "✓ Created Xcode project for iOS in $(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj" | |
# Android helpers | |
# --------------- | |
$(ANDROID_ARCHIVE_NAME_DEVICE): $(CORDOVA_SOURCE_FILES) | |
# $(call cordovaPrepare,android) | |
$(call cordovaBuild,android) --device | |
@echo "✓ Created Android build in $(ANDROID_ARCHIVE_PATH_DEBUG)" | |
$(ANDROID_ARCHIVE_NAME_GOOGLE): $(CORDOVA_SOURCE_FILES) | |
$(call cordovaPrepare,android) | |
@echo "$(call run,CORDOVA_ANDROID)" --release | |
@"$(call run,CORDOVA_ANDROID)" --release --keystore $(ANDROID_KEYSTORE_NAME) --storePassword $(ANDROID_KEYSTORE_PASSWORD) --alias $(ANDROID_KEYALIAS_NAME) --password $(ANDROID_KEYALIAS_PASSWORD) | |
@echo "✓ Created Android build in $(ANDROID_ARCHIVE_PATH_RELEASE)" | |
$(ANDROID_ARCHIVE_NAME_HOCKEY): $(CORDOVA_SOURCE_FILES) | |
$(call cordovaPrepare,android) | |
@echo "$(call run,CORDOVA_ANDROID)" --release | |
@"$(call run,CORDOVA_ANDROID)" --release --keystore $(ANDROID_KEYSTORE_NAME) --storePassword $(ANDROID_KEYSTORE_PASSWORD) --alias $(ANDROID_KEYALIAS_NAME) --password $(ANDROID_KEYALIAS_PASSWORD) | |
@echo "✓ Created Android build in $(ANDROID_ARCHIVE_PATH_RELEASE)" | |
# Code signing downloads | |
# ---------------------- | |
define downloadProvProfiles | |
$(call dexists,$(IOS_PROV_PROFILES_DIR),The provisioning profiles folder could not be found: $(IOS_PROV_PROFILES_DIR)) | |
$(call assert,$(1),No provisioning profile type was passed) | |
@cd "$(IOS_PROV_PROFILES_DIR)" && "$(call run,IOS)" profiles:download:all --type "$(1)" > /dev/null 2>&1 && echo "Downloaded $(1) provisioning profiles" | |
endef | |
define renameProvProfiles | |
$(call dexists,$(IOS_PROV_PROFILES_DIR),The provisioning profiles folder could not be found: $(IOS_PROV_PROFILES_DIR)) | |
@cd "$(IOS_PROV_PROFILES_DIR)" && \ | |
for file in *.mobileprovision; do \ | |
uuid=`$(call run,PLIST_BUDDY) -c "Print UUID" /dev/stdin <<< $$("$(call run,SECURITY)" cms -D -i "$$file")` && \ | |
if [ "$$file" != "$$uuid.mobileprovision" ]; then \ | |
mv -f "$$file" "$$uuid.mobileprovision"; \ | |
echo "Renamed $$file to $$uuid.mobileprovision"; \ | |
fi; \ | |
done | |
endef | |
.PHONY: remove-ios-prov-profiles download-ios-prov-profiles | |
remove-ios-prov-profiles: | |
$(shell rm -f "$(IOS_PROV_PROFILES_DIR)"/*.mobileprovision) | |
download-ios-prov-profiles: remove-ios-prov-profiles | |
$(call downloadProvProfiles,distribution) | |
$(call downloadProvProfiles,development) | |
$(call renameProvProfiles) | |
# Xcode helpers | |
# ------------- | |
define xcodeArchive | |
$(call assert,$(1),No archive path was specified) | |
$(call assert,$(2),No provisioning profile path was specified) | |
$(call assert,$(3),No debug information format was specified) | |
$(call dexists,$(BUILD_PATH_IOS),Please run "make ios" first) | |
"$(call run,XCODEBUILD)" -project "$(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj" -archivePath "$(1)-build.xcarchive" -scheme $(BUNDLE_NAME) archive "CODE_SIGN_IDENTITY=$(call getSignIdentityFromProfile,$(2))" "PROVISIONING_PROFILE=$(call getProfileUuid,$(2))" "DEBUG_INFORMATION_FORMAT=$(3)" >> "$(LOG)" | |
@echo "✓ Built Xcode project archive in $(1)-build.xcarchive" | |
endef | |
define xcodeExportArchive | |
$(call assert,$(1),No bundle path was specified) | |
rm -f "$(1)-build.ipa" && "$(call run,XCODEBUILD)" -exportArchive -archivePath "$(1)-build.xcarchive" -exportFormat ipa -exportPath "$(1)-build.ipa" -exportWithOriginalSigningIdentity >> "$(LOG)" | |
@echo "✓ Created iOS IPA bundle in $(1)-build.ipa" | |
endef | |
$(IOS_ARCHIVE_PATH_DEVICE).xcarchive: $(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj | |
$(call xcodeArchive,$(IOS_ARCHIVE_PATH_DEVICE),$(IOS_DEV_PROFILE_PATH),dwarf) | |
$(IOS_ARCHIVE_PATH_DEVICE).ipa: $(IOS_ARCHIVE_PATH_DEVICE).xcarchive | |
$(call xcodeExportArchive,$(IOS_ARCHIVE_PATH_DEVICE)) | |
$(IOS_ARCHIVE_PATH_ITUNES).xcarchive: $(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj | |
$(call xcodeArchive,$(IOS_ARCHIVE_PATH_ITUNES),$(IOS_PROD_PROFILE_PATH),dwarf-with-dsym) | |
$(IOS_ARCHIVE_PATH_ITUNES).ipa: $(IOS_ARCHIVE_PATH_ITUNES).xcarchive | |
$(call xcodeExportArchive,$(IOS_ARCHIVE_PATH_ITUNES)) | |
$(IOS_ARCHIVE_PATH_HOCKEY).xcarchive: $(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj | |
$(call xcodeArchive,$(IOS_ARCHIVE_PATH_HOCKEY),$(IOS_DEV_PROFILE_PATH),dwarf-with-dsym) | |
$(IOS_ARCHIVE_PATH_HOCKEY).ipa: $(IOS_ARCHIVE_PATH_HOCKEY).xcarchive | |
$(call xcodeExportArchive,$(IOS_ARCHIVE_PATH_HOCKEY)) | |
$(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip: $(IOS_ARCHIVE_PATH_HOCKEY).xcarchive | |
$(eval DSYM := $(wildcard $(IOS_ARCHIVE_PATH_HOCKEY).xcarchive/dSYMs/*.dSYM)) | |
@rm -f "$(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip" && zip -r "$(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip" "$(DSYM)" > /dev/null | |
@echo "✓ Zipped dSYM debug archive to $(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip" | |
# Distribution | |
# ------------ | |
.PHONY: distribute-ios-device distribute-ios-itunes distribute-ios-hockeyapp | |
distribute-ios-device: $(BUILD_PATH_IOS)/$(BUNDLE_NAME).xcodeproj | |
"$(call run,CORDOVA)" --device compile ios | |
"$(call run,IOS_DEPLOY)" -e -1 $(BUNDLE_ID) && "$(call run,IOS_DEPLOY)" -9 -1 $(BUNDLE_ID); \ | |
"$(call run,IOS_DEPLOY)" -L -b $(BUILD_PATH_IOS)/build/device/$(BUNDLE_NAME).app | |
@echo "✓ Installed iOS IPA bundle on connected device" | |
distribute-ios-itunes: $(IOS_ARCHIVE_PATH_ITUNES).ipa | |
$(call assert,$(IOS_ITUNES_APP_ID),No iTunes application ID has been configured) | |
"$(call run,IPA)" distribute:itunesconnect --file "$(IOS_ARCHIVE_PATH_ITUNES)-build.ipa" --apple-id "$(IOS_ITUNES_APP_ID)" --upload | |
@echo "✓ Distributed iOS IPA bundle to iTunes Connect" | |
distribute-ios-hockeyapp: $(IOS_ARCHIVE_PATH_HOCKEY).ipa $(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip | |
$(call assert,$(IOS_HOCKEYAPP_APP_ID),The HockeyApp application ID environment variable (IOS_HOCKEYAPP_APP_ID) has not been set) | |
$(call assert,$(IOS_HOCKEYAPP_API_TOKEN),The HockeyApp API token environment variable (IOS_HOCKEYAPP_API_TOKEN) has not been set) | |
$(if $(call xresolve,IPA), \ | |
"$(call run,IPA)" distribute:hockeyapp --notes "Uploaded: `date`" --identifier "$(IOS_HOCKEYAPP_APP_ID)" --token "$(IOS_HOCKEYAPP_API_TOKEN)" --dsym "$(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip" --file "$(IOS_ARCHIVE_PATH_HOCKEY).ipa", \ | |
$(if $(call xresolve,PUCK), \ | |
"$(call run,PUCK)" -force=true -upload=all -submit=auto -notes="Uploaded: `date`" -app_id="$(IOS_HOCKEYAPP_APP_ID)" -api_token="$(IOS_HOCKEYAPP_API_TOKEN)" -dsym_path="$(IOS_ARCHIVE_PATH_HOCKEY)-dsym.zip" "$(IOS_ARCHIVE_PATH_HOCKEY).ipa", \ | |
$(error Could not distribute to HockeyApp. Your options: (1) $(IPA_ERR) (2) $(PUCK_ERR)) \ | |
) \ | |
) | |
@echo "✓ Distributed iOS IPA bundle to HockeyApp" | |
.PHONY: distribute-android-device distribute-android-googleplay distribute-android-kindlestore distribute-android-hockeyapp | |
distribute-android-device: $(ANDROID_ARCHIVE_NAME_DEVICE) | |
"$(call run,CORDOVA)" --device --nobuild run android | |
@echo "✓ Installed Android bundle on connected device" | |
distribute-android-googleplay: $(ANDROID_ARCHIVE_NAME_GOOGLE) | |
$(call assert,$(GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_KEY),Please set the GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_KEY environment variable to the path leading to the Android Service Account JSON key file) | |
DEBUG=google-play-publisher $(call run,GOOGLE_PLAY_PUBLISHER) --track "$(GOOGLE_PLAY_TRACK)" --auth "$(GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_KEY)" "$(ANDROID_ARCHIVE_PATH)/$(ANDROID_ARCHIVE_PATH_RELEASE)" | |
@echo "✓ Published Android bundle to Google Play ($(GOOGLE_PLAY_TRACK) track)" | |
distribute-android-hockeyapp: $(ANDROID_ARCHIVE_NAME_HOCKEY) | |
$(call assert,$(ANDROID_HOCKEYAPP_APP_ID),The HockeyApp application ID environment variable (ANDROID_HOCKEYAPP_APP_ID) has not been set) | |
$(call assert,$(ANDROID_HOCKEYAPP_API_TOKEN),The HockeyApp API token environment variable (ANDROID_HOCKEYAPP_API_TOKEN) has not been set) | |
"$(call run,PUCK)" -force=true -upload=all -submit=auto -app_id="$(ANDROID_HOCKEYAPP_APP_ID)" -api_token="$(ANDROID_HOCKEYAPP_API_TOKEN)" -notes="Uploaded: `date`" "$(ANDROID_ARCHIVE_PATH)/$(ANDROID_ARCHIVE_PATH_RELEASE)" | |
@echo "✓ Distributed Android bundle to HockeyApp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment