diff --git a/scripts/create_release.py b/scripts/create_release.py index f6fe50cd..e1bddae3 100644 --- a/scripts/create_release.py +++ b/scripts/create_release.py @@ -1,7 +1,15 @@ import os import logging +import sys +import shutil from datetime import datetime from github import Github + +BLENDER_ADDONS = list(filter(None, os.environ.get('BLENDER_ADDONS', 'send2ue,ue2rigify').split(','))) +PROJECT_FOLDER = os.path.join( + os.path.dirname(__file__), + os.pardir +) logging.basicConfig(level=logging.INFO) @@ -111,9 +119,33 @@ def create_release(self): logging.info(f'Successfully released!') +def package_addons(addon_release_folder): + """ + Packages the addons up into zip files. + """ + # remove any existing releases + if os.path.exists(addon_release_folder): + logging.info(f'Deleting existing release folder "{addon_release_folder}"...') + shutil.rmtree(addon_release_folder) + + # get the addon packager class + sys.path.append(os.path.join(PROJECT_FOLDER, 'tests')) + from utils.addon_packager import AddonPackager + + # package the addons + for addon_name in BLENDER_ADDONS: + addon_folder_path = os.path.join(PROJECT_FOLDER, addon_name) + addon_packager = AddonPackager(addon_name, addon_folder_path, addon_release_folder) + addon_packager.zip_addon() + + if __name__ == '__main__': - # check for releases release_folder = os.path.join(os.path.dirname(__file__), os.pardir, 'release') + + # package the addons + package_addons(release_folder) + + # check for releases for zip_file in os.listdir(release_folder): release_addon = ReleaseAddon( repo_name=os.environ.get('REPO'), diff --git a/tests/utils/addon_packager.py b/tests/utils/addon_packager.py index 827cb735..52af53d7 100644 --- a/tests/utils/addon_packager.py +++ b/tests/utils/addon_packager.py @@ -120,7 +120,7 @@ def copy_addon(self): """ destination = os.path.join(self.output_folder, self.addon_name) - logging.debug(f'Copying addon "{self.addon_folder_path}" to "{destination}"') + logging.info(f'Copying addon "{self.addon_folder_path}" to "{destination}"') # change the permissions to allow the folders contents to be modified. if sys.platform == 'win32': @@ -137,7 +137,7 @@ def zip_addon(self): """ Zips up the addon. """ - logging.debug(f'zipping addon "{self.addon_name}" to "{self.output_folder}"') + logging.info(f'zipping addon "{self.addon_name}" to "{self.output_folder}"') # get the folder paths versioned_zip_file_path = self.get_addon_zip_path() versioned_folder_path = versioned_zip_file_path.replace('.zip', '')