-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathxcodebuild-clean-archive-export
executable file
·38 lines (35 loc) · 1.34 KB
/
xcodebuild-clean-archive-export
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Xcode build script to clean, archive, and export an ipa file.
#
# This automatically detects the project name and parameters:
#
# * The name: the name of the first file that ends with ".xcodeproj"
# * The project: the name + ".xcodeproj"
# * The archivePath: the name + ".xcarchive"
# * The scheme: the name
# * The exportPath: the name
#
# Version: 1.0.0
# Created: 2015-01-22
# Updated: 2015-12-22
# License: GPL
# Contact: Joel Parker Henderson ([email protected])
##
set -euf -o
out () { printf %s\\n "$*" ; }
base=$(basename $(find . -regex '.*\.xcodeproj' | head -1 | sed 's/\.xcodeproj$//' ))
project="$base.xcodeproj"
archivePath="$base.xcarchive"
scheme="$base"
provisioningProfile=$(basename $(find . -regex '.*mobileprovision$') | sed 's/\.mobileprovision$//' | head -1)
exportPath="$base"
out "project:$project"
out "archivePath:$archivePath"
out "scheme:$scheme"
out "provisioningProfile:$provisioningProfile"
out "exportPath:$exportPath"
# Run clean, archive, export
XCODE_VERSION=6 xcodebuild clean -project "$project" -configuration Release -alltargets
XCODE_VERSION=6 xcodebuild archive -project "$project" -scheme "$scheme" -archivePath "$archivePath"
XCODE_VERSION=6 xcodebuild -exportArchive -archivePath "$archivePath" -exportPath "$exportPath" -exportFormat ipa -exportProvisioningProfile "$provisioningProfile"