diff --git a/scripts/post_build.py b/scripts/post_build.py index 057ba01..53e6b34 100644 --- a/scripts/post_build.py +++ b/scripts/post_build.py @@ -1,12 +1,8 @@ import testflight as tf def PublishToTestFlight(config): - api_token = config['api_token'] - team_token = config['team_token'] - - publisher = tf.TestFlightPublisher(api_token, team_token) - publisher.Publish(config) - + publisher = tf.TestFlightPublisher(config) + publisher.Publish() def PrintToConsole(config): print 'Sample post build action!' \ No newline at end of file diff --git a/scripts/settings.py b/scripts/settings.py index 6cede79..c0a4cdb 100644 --- a/scripts/settings.py +++ b/scripts/settings.py @@ -10,8 +10,11 @@ build_root = { ios_root = { 'sln_path' : '/Users/rzaitov/Documents/Apps/BuildScript/BuildSample/BuildSample.sln', - 'api_token': '0e6925075d4fc10fed0e7bbf43fa6894_NjQ0OTI2MjAxMi0wOS0yNSAxMTo0MDozNi40OTY5MjU', - 'team_token': 'c5c3cf7a6dae2bea4382dfbd181a2075_Mjc4ODkwMjAxMy0wOS0yOSAxNDowOTo1OC40Mzg5MTY', + + 'tf_api_token': '0e6925075d4fc10fed0e7bbf43fa6894_NjQ0OTI2MjAxMi0wOS0yNSAxMTo0MDozNi40OTY5MjU', + 'tf_team_token': 'c5c3cf7a6dae2bea4382dfbd181a2075_Mjc4ODkwMjAxMy0wOS0yOSAxNDowOTo1OC40Mzg5MTY', + 'ft_notes': 'This build was uploaded via the upload API', + 'parent' : build_root } diff --git a/scripts/testflight.py b/scripts/testflight.py index 94611ff..980f960 100644 --- a/scripts/testflight.py +++ b/scripts/testflight.py @@ -17,14 +17,20 @@ class TestFlightPublisherBase: return ret_code class TestFlightPublisher(TestFlightPublisherBase): - def __init__(self, api_token, team_token, notes=TestFlightPublisherBase.DefaultNotes): + def __init__(self, config): + self._config = config + + api_token = config['tf_api_token'] + team_token = config['tf_team_token'] + notes = config.get('ft_notes', None) + TestFlightPublisherBase.__init__(self, api_token, team_token, notes) - def Publish(self, config): - sln_path = config['sln_path'] + def Publish(self): + sln_path = self._config['sln_path'] sln_dir = os.path.dirname(sln_path) - ipa_rel_path = 'BuildSample/bin/iPhone/Release/BuildSample-{0}.ipa'.format(config['version']) + ipa_rel_path = 'BuildSample/bin/iPhone/Release/BuildSample-{0}.ipa'.format(self._config['version']) ipa_abs_path = os.path.join(sln_dir, ipa_rel_path) return TestFlightPublisherBase.Publish(self, ipa_abs_path) \ No newline at end of file