-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Use Python script to move compiled LaTeX files
Moves all created PDFs to `release` folder instead of manually specifying each one in the YAML config file
- Loading branch information
1 parent
b2771f8
commit c66c560
Showing
3 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import shutil | ||
|
||
|
||
# Define folders | ||
base_folder = "src" | ||
release_folder = "release" | ||
|
||
# Ensure the release folder exists | ||
if not os.path.exists(release_folder): | ||
os.makedirs(release_folder) | ||
|
||
# Go through all subdirectories | ||
for root, dirs, files in os.walk(base_folder): | ||
for file in files: | ||
if file != "main.pdf": | ||
# Skip file if it's not `main.pdf` | ||
continue | ||
|
||
# Construct the original file path | ||
old_path = os.path.join(root, file) | ||
|
||
# Create the new file name with '-' instead of '/' | ||
relative_path = os.path.relpath(old_path, base_folder) | ||
new_filename = relative_path.replace(os.sep, "-") | ||
|
||
# Construct the new file path | ||
new_path = os.path.join(release_folder, new_filename) | ||
|
||
# Move and rename the file | ||
shutil.move(old_path, new_path) | ||
print(f"Moved {old_path} to {new_path}") |