Skip to content

Commit

Permalink
Fix macos profiles extension (#89)
Browse files Browse the repository at this point in the history
* macos related profiles should be exported with .provisionprofile extension, not .mobileprovision

* refactor

* refactor

* Update CHANGELOG.md

Co-authored-by: Priit Lätt <[email protected]>

Co-authored-by: Priit Lätt <[email protected]>
  • Loading branch information
BondarenkoStas and priitlatt authored Apr 12, 2021
1 parent 76e06f2 commit c7d77e0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 0.5.5
-------------

**Improvements**

- Bugfix: export MacOS application's provisioning profiles with `.provisionprofile` extension instead of `.mobileprovision`.

Version 0.5.4
-------------

Expand Down
2 changes: 1 addition & 1 deletion src/codemagic/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'codemagic-cli-tools'
__description__ = 'CLI tools used in Codemagic builds'
__version__ = '0.5.4'
__version__ = '0.5.5'
__url__ = 'https://github.com/codemagic-ci-cd/cli-tools'
__licence__ = 'GNU General Public License v3.0'
4 changes: 4 additions & 0 deletions src/codemagic/apple/resources/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def is_ad_hoc_type(self) -> bool:
def is_development_type(self) -> bool:
return self.value.endswith('_DEVELOPMENT')

@property
def is_macos_profile(self) -> bool:
return self.value.startswith('MAC_')

def devices_not_allowed(self) -> bool:
return not self.devices_allowed()

Expand Down
6 changes: 6 additions & 0 deletions src/codemagic/apple/resources/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class Relationships(Resource.Relationships):
def get_display_info(self) -> str:
return f'{self.attributes.profileType} profile {self.attributes.uuid}'

@property
def profile_extension(self) -> str:
if self.attributes.profileType.is_macos_profile:
return '.provisionprofile'
return '.mobileprovision'

@property
def profile_content(self) -> bytes:
return b64decode(self.attributes.profileContent)
3 changes: 2 additions & 1 deletion src/codemagic/tools/app_store_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ def _get_unique_path(cls, file_name: str, destination: pathlib.Path) -> pathlib.
return pathlib.Path(tf.name)

def _save_profile(self, profile: Profile) -> pathlib.Path:
profile_path = self._get_unique_path(f'{profile.get_display_info()}.mobileprovision', self.profiles_directory)
profile_path = self._get_unique_path(
f'{profile.get_display_info()}{profile.profile_extension}', self.profiles_directory)
profile_path.write_bytes(profile.profile_content)
self.printer.log_saved(profile, profile_path)
return profile_path
Expand Down

0 comments on commit c7d77e0

Please sign in to comment.