Instantly share code, notes, and snippets.

@Leko /build-ios
Last active Sep 6, 2017

Embed
What would you like to do?
Build ReactNative application via CLI
#!/usr/bin/env bash
# Usage:
# build-ios <SCHEME> <EXPORT_PLIST>
#
# SCHEME:
# EXPORT_PLIST:
set -eu
SCHEME=$1
EXPORT_PLIST=$2
PROJECT=$(find ios/*.xcodeproj | head -n1)
mkdir -p target
xcodebuild \
-project "$PROJECT" \
-scheme "$SCHEME" \
archive \
-archivePath "./target/$SCHEME.xcarchive"
xcodebuild \
-exportArchive \
-archivePath "./target/$SCHEME.xcarchive" \
-exportPath ./target \
-exportOptionsPlist $EXPORT_PLIST
echo -e "\e[33mArchive: ./target/$SCHEME.xcarchive\e[m"
echo -e "\e[33mIPA: ./target/$SCHEME.ipa\e[m"
#!/usr/bin/env bash
# Usage:
# DEPLOY_GATE_TOKEN=XXXXX deploy <apk or ipa path> [DEPLOYGATE_USERNAME] [DEPLOY_MESSAGE]
set -eux
PKG_PATH=$1
DEPLOYGATE_USERNAME=$2
DEPLOY_MESSAGE=${3:-$(git log --oneline --no-merges -n1 --color=never)}
curl \
-F "token=$DEPLOY_GATE_TOKEN" \
-F "file=@$PKG_PATH" \
-F "message=$DEPLOY_MESSAGE" \
https://deploygate.com/api/users/$DEPLOYGATE_USERNAME/apps
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- app-store, ad-hoc, package, enterprise, development, developer-id -->
<key>method</key>
<string>ad-hoc</string>
<key>uploadBitcode</key>
<false/>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
# http://crunchybagel.com/auto-incrementing-build-numbers-in-xcode/
PROJECT=$1
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PROJECT/Info.plist")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$PROJECT/Info.plist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment