@@ -50,6 +50,26 @@ def get_release_id(repo, tag_name, token):
50
50
response .raise_for_status ()
51
51
return response .json ()['id' ]
52
52
53
+ def zip_bsp_related_files (archive_path , repo_dir ):
54
+ support .copy_files_with_structure (
55
+ os .path .join (repo_dir , 'bsp' ),
56
+ os .path .join (repo_dir , 'output/bsps' ),
57
+ [
58
+ 'board.h' ,
59
+ 'mcu_card.h'
60
+ ]
61
+ )
62
+ support .copy_files_with_structure (
63
+ repo_dir ,
64
+ os .path .join (repo_dir , 'output/bsps' ),
65
+ [
66
+ 'mcu_definitions.h' ,
67
+ 'can_definitions.h' ,
68
+ 'dma_definitions.h'
69
+ ]
70
+ )
71
+ create_template_archive ('output' , archive_path )
72
+
53
73
if __name__ == '__main__' :
54
74
parser = argparse .ArgumentParser (description = "Upload directories as release assets." )
55
75
parser .add_argument ("token" , help = "GitHub Token" )
@@ -64,26 +84,28 @@ def get_release_id(repo, tag_name, token):
64
84
# Set copyright year for all files to current year
65
85
support .update_copyright_year (repo_dir )
66
86
87
+ # Get the release ID used to upload assets
88
+ release_id = get_release_id (args .repo , f'mikroSDK-{ version } ' , args .token )
89
+
67
90
if manifest_folder :
68
91
archive_path = os .path .join (repo_dir , 'mikrosdk.7z' )
69
92
print ('Creating archive: %s' % archive_path )
70
93
create_7z_archive (version , repo_dir , archive_path )
71
94
print ('Archive created successfully: %s' % archive_path )
72
-
73
- # Get the release ID and upload the asset
74
- release_id = get_release_id (args .repo , f'mikroSDK-{ version } ' , args .token )
75
95
upload_result = upload_asset_to_release (args .repo , release_id , archive_path , args .token )
76
-
77
96
print ('Asset "%s" uploaded successfully to release ID: %s' % ('mikrosdk' , release_id ))
78
97
79
98
if os .path .exists (os .path .join (repo_dir , 'templates' )):
80
99
archive_path = os .path .join (repo_dir , 'templates.7z' )
81
100
print ('Creating archive: %s' % archive_path )
82
101
create_template_archive ('templates' , archive_path )
83
102
print ('Archive created successfully: %s' % archive_path )
84
-
85
- # Get the release ID and upload the asset
86
- release_id = get_release_id (args .repo , f'mikroSDK-{ version } ' , args .token )
87
103
upload_result = upload_asset_to_release (args .repo , release_id , archive_path , args .token )
88
-
89
104
print ('Asset "%s" uploaded successfully to release ID: %s' % ('templates' , release_id ))
105
+
106
+ # BSP asset
107
+ archive_path = os .path .join (repo_dir , 'bsps.7z' )
108
+ print ('Creating archive: %s' % archive_path )
109
+ zip_bsp_related_files (archive_path , repo_dir )
110
+ upload_result = upload_asset_to_release (args .repo , release_id , archive_path , args .token )
111
+ print ('Asset "%s" uploaded successfully to release ID: %s' % ('bsps' , release_id ))
0 commit comments