Skip to content

Instantly share code, notes, and snippets.

@BlackFoks
Forked from jrschumacher/build-and-deploy.sh
Created February 16, 2016 08:01
Show Gist options
  • Save BlackFoks/36813aaa55adba724a54 to your computer and use it in GitHub Desktop.
Save BlackFoks/36813aaa55adba724a54 to your computer and use it in GitHub Desktop.
Ionic Automated Build and Deploy to HockeyApp
#!/bin/bash
PROJECT_NAME=MyApp
SCHEME_NAME=MyApp
STARTTIME=$(date +%s);
set -e
set -x
### Install dependencies
echo "--- Install dependencies [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
/usr/local/bin/npm install
/usr/local/bin/bower install
### Restore ionic platforms
echo "--- Restore ionic platforms [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
/usr/local/bin/ionic state restore
### Build
echo "--- Build [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
/usr/local/bin/gulp sass
/usr/local/bin/gulp build
### Moving to ios build directory
echo "--- Moving to ios build directory [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
cd platforms/ios
### Cleaning Xcode
echo "--- Cleaning Xcode [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
/usr/bin/xcodebuild clean \
-project $PROJECT_NAME.xcodeproj \
-configuration Release \
-alltargets
### Archiving
echo "--- Archiving [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
/usr/bin/xcodebuild archive \
-project $PROJECT_NAME.xcodeproj \
-scheme $SCHEME_NAME \
-archivePath $PROJECT_NAME
### Uploading to Hockeyapp
echo "--- Uploading to Hockeyapp [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
/usr/local/bin/puck \
-notes_path=../../RELEASE_NOTES.md \
-notes_type=markdown \
-submit=auto \
-download=true \
-mandatory=true \
-notify=true \
-force=true \
$PROJECT_NAME.xcarchive
### Summary
echo "-- Total time $(($(date +%s) - $STARTTIME))s"
@BlackFoks
Copy link
Author

Here is command line script for creating archive and IPA example. I have an iPhone xcode project , which is located in Desktop/MyiOSApp folder.

Execute following commands one by one.

cd /Users/username/Desktop/MyiOSApp/

xcodebuild -scheme MyiOSApp archive \
    -archivePath /Users/username/Desktop/MyiOSApp.xcarchive

xcodebuild -exportArchive -exportFormat ipa \
    -archivePath "/Users/username/Desktop/MyiOSApp.xcarchive" \
    -exportPath "/Users/username/Desktop/MyiOSApp.ipa" \
    -exportProvisioningProfile "MyCompany Distribution Profile"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment