Created
April 9, 2018 18:46
-
-
Save RLittlesII/99357a96d54a534ac1387f43c415c59a to your computer and use it in GitHub Desktop.
Cake script for running Fastlane Match
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
#addin nuget:?package=Cake.Fastlane&version=0.1.0 | |
////////////////////////////////////////// | |
// ARGUMENTS | |
////////////////////////////////////////// | |
var target = Argument<string>("target", "Default"); | |
var development = Argument<bool>("development", true); | |
////////////////////////////////////////// | |
// VARIABLES | |
////////////////////////////////////////// | |
var gitUrl = "https://contoso.visualstudio.com/DemoApp/_git/demoapp_certs"; | |
var userName = "developers@contoso.com"; | |
////////////////////////////////////////// | |
// SETUP / TEARDOWN | |
////////////////////////////////////////// | |
Setup(context => | |
{ | |
Information(DateTime.Now); | |
}); | |
Teardown(context => | |
{ | |
Information(DateTime.Now); | |
}); | |
void Match(string appIdentifier, CertificateType certificateType, bool force = false, bool forceForNewDevices = true) | |
{ | |
var configuration = new MatchConfiguration | |
{ | |
GitUrl = gitUrl, | |
CertificateType = certificateType, | |
AppIdentifier = appIdentifier, | |
UserName = userName, | |
Force = force, | |
ForceForNewDevices = forceForNewDevices | |
}; | |
Fastlane.Match(configuration); | |
} | |
////////////////////////////////////////// | |
// TASKS | |
////////////////////////////////////////// | |
Task("Local-Development") | |
.WithCriteria(() => development) | |
.Does(() => Match("com.contoso.demoapp.local", CertificateType.Development)); | |
Task("Local-AdHoc") | |
.WithCriteria(() => !development) | |
.Does(() => Match("com.contoso.demoapp.local", CertificateType.AdHoc)); | |
Task("Mock-Development") | |
.WithCriteria(() => development) | |
.Does(() => Match("com.contoso.demoapp.mock", CertificateType.Development)); | |
Task("Mock-AdHoc") | |
.WithCriteria(() => !development) | |
.Does(() => Match("com.contoso.demoapp.mock", CertificateType.AdHoc)); | |
Task("Dev-Development") | |
.WithCriteria(() => development) | |
.Does(() => Match("com.contoso.demoapp.dev", CertificateType.Development)); | |
Task("Dev-AdHoc") | |
.WithCriteria(() => !development) | |
.Does(() => Match("com.contoso.demoapp.dev", CertificateType.AdHoc)); | |
Task("Test-Development") | |
.WithCriteria(() => development) | |
.Does(() => Match("com.contoso.demoapp.test", CertificateType.Development)); | |
Task("Test-AdHoc") | |
.WithCriteria(() => !development) | |
.Does(() => Match("com.contoso.demoapp.test", CertificateType.AdHoc)); | |
Task("Prod").Does(() => Match("com.contoso.demoapp.prod", CertificateType.AdHoc)); | |
Task("Store").Does(() => Match("com.contoso.demoapp", CertificateType.AppStore)); | |
Task("Development") | |
.Does(() => | |
{ | |
var configuration = new MatchConfiguration | |
{ | |
GitUrl = gitUrl, | |
CertificateType = CertificateType.Development, | |
UserName = userName, | |
Force = true | |
}; | |
Fastlane.Match(configuration); | |
}); | |
Task("AppStore") | |
.Does(() => | |
{ | |
var configuration = new MatchConfiguration | |
{ | |
GitUrl = gitUrl, | |
CertificateType = CertificateType.AppStore, | |
UserName = userName, | |
Force = true | |
}; | |
Fastlane.Match(configuration); | |
}); | |
////////////////////////////////////////// | |
// RUN TARGETS | |
////////////////////////////////////////// | |
Task("Local") | |
.IsDependentOn("Local-Development") | |
.IsDependentOn("Local-AdHoc"); | |
Task("Mock") | |
.IsDependentOn("Mock-Development") | |
.IsDependentOn("Mock-AdHoc"); | |
Task("Dev") | |
.IsDependentOn("Dev-Development") | |
.IsDependentOn("Dev-AdHoc"); | |
Task("Test") | |
.IsDependentOn("Test-Development") | |
.IsDependentOn("Test-AdHoc"); | |
Task("All-Certificates") | |
.IsDependentOn("Development") | |
.IsDependentOn("AppStore"); | |
Task("Development-Profiles") | |
.IsDependentOn("Local-Development") | |
.IsDependentOn("Mock-Development") | |
.IsDependentOn("Dev-Development") | |
.IsDependentOn("Test-Development"); | |
Task("All-Profiles") | |
.IsDependentOn("Local") | |
.IsDependentOn("Mock") | |
.IsDependentOn("Dev") | |
.IsDependentOn("Test") | |
.IsDependentOn("Prod") | |
.IsDependentOn("Store"); | |
Task("Default"); | |
RunTarget(target); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment