Created
February 5, 2017 22:13
-
-
Save jjrscott/c647b2d554a41f3bb960fd8f6979a18d to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/perl | |
# This script builds an archive release of a project. It should be run thus: | |
# $ cd <the project directory> | |
# $ build_project | |
use strict; | |
use Data::Dumper; | |
use Getopt::Long; | |
my $scheme; | |
my $productVersion; | |
my $productBuild; | |
GetOptions | |
( | |
"scheme=s" => \$scheme, | |
"product-version=s" => \$productVersion, | |
"product-build=s" => \$productBuild, | |
); | |
if (!defined $productBuild) | |
{ | |
$productBuild = 0; | |
foreach my $tag (qx(git tag -l 'build-*')) | |
{ | |
chomp $tag; | |
$tag =~ s/build-//; | |
$productBuild = $tag if ($productBuild < $tag); | |
} | |
$productBuild += 1; | |
} | |
my $currentDate=`date "+%Y-%m-%d-%H%M%S"`; | |
chomp $currentDate; | |
my $archivePrefix="$ENV{HOME}/Downloads/${scheme}_${productVersion}_${productBuild}_${currentDate}"; | |
my $archivePath="${archivePrefix}.xcarchive"; | |
my $derivedDataPath="${archivePrefix}.build"; | |
system "xcodebuild", "-scheme", "${scheme}", "archive", "-archivePath", "${archivePath}", "-derivedDataPath", "${derivedDataPath}", "PRODUCT_VERSION=${productVersion}", "PRODUCT_BUILD=${productBuild}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment