Skip to content

Instantly share code, notes, and snippets.

@Leko
Last active September 6, 2017 01:52
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 Leko/e6d205993466ce7865a905259b6d18a2 to your computer and use it in GitHub Desktop.
Save Leko/e6d205993466ce7865a905259b6d18a2 to your computer and use it in GitHub Desktop.
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