@@ -153,24 +153,36 @@ def seven_zip_extract(input_path, outputDir=None):
153
153
154
154
call (args )
155
155
156
+ def seven_zip_compress (input_path , output_path ):
157
+ args = ["7z" , "a" , "-md=512m" , output_path , input_path , "-y" ]
158
+
159
+ call (args )
160
+
161
+
162
+ def get_chapter_name_and_translation_from_git_tag ():
163
+ returned_chapter_name = None
164
+ translation = False
156
165
157
- def get_chapter_name_from_git_tag ():
158
166
if GIT_TAG is None :
159
167
raise Exception (
160
- "'github_actions' was selected, but environment variable GIT_REF was not set - are you sure you're running this script from Github Actions?"
168
+ "'github_actions' was selected, but environment variable GITHUB_REF was not set - are you sure you're running this script from Github Actions?"
161
169
)
162
170
else :
163
171
# Look for the chapter name to build in the git tag
164
172
tag_fragments = [x .lower () for x in re .split ("[\W_]" , GIT_REF )]
165
173
166
174
if "all" in tag_fragments :
167
- return "all"
175
+ returned_chapter_name = "all"
168
176
else :
169
177
for chapter_name in chapter_to_build_variants .keys ():
170
178
if chapter_name .lower () in tag_fragments :
171
- return chapter_name
179
+ returned_chapter_name = chapter_name
180
+ break
181
+
182
+ if "translation" in tag_fragments :
183
+ translation = True
172
184
173
- return None
185
+ return returned_chapter_name , translation
174
186
175
187
176
188
def get_build_variants (selected_chapter : str ) -> List [BuildVariant ]:
@@ -244,18 +256,23 @@ def save(self):
244
256
args = parser .parse_args ()
245
257
246
258
force_download = args .force_download
259
+
260
+ # NOTE: For now, translation archive output is always enabled, as most of the time this script will be used for translators
247
261
translation = args .translation
248
262
249
263
# Get chapter name from git tag if "github_actions" specified as the chapter
250
264
chapter_name = args .chapter
251
265
if chapter_name == "github_actions" :
252
- chapter_name = get_chapter_name_from_git_tag ()
266
+ chapter_name , translation = get_chapter_name_and_translation_from_git_tag ()
253
267
if chapter_name is None :
254
268
print (
255
269
f">>>> WARNING: No chapter name (or 'all') was found in git tag { GIT_TAG } - skipping building .assets"
256
270
)
257
271
exit (0 )
258
272
273
+ # NOTE: For now, translation archive output is always enabled, as most of the time this script will be used for translators
274
+ translation = True
275
+
259
276
# Get a list of build variants (like 'onikakushi 5.2.2f1 win') depending on commmand line arguments
260
277
build_variants = get_build_variants (chapter_name )
261
278
build_variants_list = "\n - " .join ([b .get_build_command () for b in build_variants ])
@@ -347,3 +364,11 @@ def save(self):
347
364
if build_variant .translation_default :
348
365
destination_default_sharedassets = os .path .join (translation_data_dir , "sharedassets0.assets" )
349
366
shutil .copyfile (source_sharedassets , destination_default_sharedassets )
367
+
368
+ if translation :
369
+ containing_folder = "output"
370
+ output_path = "output/translation.7z"
371
+ if os .path .exists (output_path ):
372
+ os .remove (output_path )
373
+
374
+ seven_zip_compress ('output/translation' , output_path )
0 commit comments