Skip to content

Commit

Permalink
Merge pull request #678 from jamesbaber1/main
Browse files Browse the repository at this point in the history
Updated Release Script
  • Loading branch information
iigindesign authored Nov 3, 2023
2 parents 2396c20 + b7bde48 commit 4a3d080
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
34 changes: 33 additions & 1 deletion scripts/create_release.py
Original file line number Diff line number Diff line change
@@ -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)


Expand Down Expand Up @@ -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'),
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/addon_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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', '')
Expand Down

0 comments on commit 4a3d080

Please sign in to comment.