-
-
Save benrudhart/1525c82fea925c985b90 to your computer and use it in GitHub Desktop.
Script for Uploading an xcode archive to HockeyApp with Xcode Server 4.0 using Xcode 6.1. Automatically creates a markdown change log based on the commit bodies from accepted pull requests.
This file contains hidden or 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
# Valid and working as of 11/10/2014 | |
# Xcode 6.1, XCode Server 4.0 | |
#Upload Archive to HockeyApp | |
#Settings | |
PRODUCT_NAME="<Product name>" | |
PRODUCT_FOLDER="<Product Folder>" | |
SIGNING_IDENTITY="<identity>" | |
#"This has to be exactly what you see in Keychain -> My Certificates" | |
#EXAMPLE:"iPhone Distribution: Unwired Revolution, LLC." | |
PROVISIONING_PROFILE="/Library/Developer/XcodeServer/ProvisioningProfiles/<profile name>.mobileprovision" | |
#"You will have to manually copy your profile from (local)/ to (server) | |
# ~/Library/MobileDevice/Provisioning Profiles/<profile>.mobileprovision | |
# /Library/Server/Xcode/Data/ProvisioningProfiles/<profile>.mobileprovision | |
#EXAMPLE:"/Library/Server/Xcode/Data/ProvisioningProfiles/DocLink_InHouse_2013.mobileprovision" | |
#The name of the profile can be found at the end of the build service warnings from xcode bots, whenever the code signing fails. | |
#if you dont use xcode bots :!!!For proper signing of the App you have to add '$(SDKROOT)/ResourceRules.plist' to the 'Code Signing Resource Rules Path' field.'!!! | |
#HockeyApp Settings | |
APP_ID="<your app id>" | |
API_TOKEN="<your api token>" | |
NOTIFY="0" | |
# 0 - Do not notify, 1 - Notify users by e-mail | |
STATUS="2" | |
# 1 - Don't allow users to download, 2 - Available for download | |
MANDATORY="0" | |
# 0 - No, 1 - Yes | |
########################################## | |
# Create Commit Notes | |
cd $PRODUCT_FOLDER | |
NumberOfCommit=25 | |
HistoryLogs=$(git log -$NumberOfCommit --grep "Merge pull request #" --pretty="%b,") | |
HistoryHashes=$(git log -$NumberOfCommit --grep "Merge pull request #" --pretty="%h") | |
array=(${HistoryHashes//,/ }) | |
CurrentBuildVersion=$(git rev-list --count ${array[0]}) | |
PreviousBuildVersion=$(git rev-list --count ${array[1]}) | |
unset array[0] | |
# get Logs_ARRAY | |
OLD_IFS="$IFS" | |
IFS="," | |
Logs_ARRAY=( $HistoryLogs ) | |
IFS="$OLD_IFS" | |
CurrentCommit=${Logs_ARRAY[0]} | |
unset Logs_ARRAY[0] | |
# build changelog history | |
ChangeLog=$(for i in "${!array[@]}" | |
do | |
BuildVersion=$(git rev-list --count ${array[i]}) | |
echo - **#$BuildVersion** ${Logs_ARRAY[i]} | |
done) | |
##################################################### | |
# Upload to HockeyApp | |
echo "*** Uploading to HockeyApp ***" | |
BreakLine=$'\n' | |
cd $XCS_OUTPUT_DIR | |
/bin/cp -Rp ${XCS_ARCHIVE}/dSYMs/${PRODUCT_NAME}.app.dSYM ./ | |
/usr/bin/zip -r "DSYM" "${PRODUCT_NAME}.app.dSYM" | |
/usr/bin/curl "https://rink.hockeyapp.net/api/2/apps/${APP_ID}/app_versions/upload" \ | |
-F notify="${NOTIFY}" \ | |
-F status="${STATUS}" \ | |
-F mandatory="${MANDATORY}" \ | |
-F ipa=@"${XCS_PRODUCT}" \ | |
-F dsym=@"DSYM.zip" \ | |
-F notes="### Current Version (#${CurrentBuildVersion})${BreakLine}- ${CurrentCommit}${BreakLine}${BreakLine}###History${BreakLine}${ChangeLog}" \ | |
-F notes_type="1" \ | |
-H "X-HockeyAppToken: ${API_TOKEN}" | |
echo "*** HockeyApp upload finished! ***" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment