From 96f2484f123d4ce808debd20de0dfd9256ffdd72 Mon Sep 17 00:00:00 2001 From: Futrime Date: Wed, 22 Nov 2023 10:19:06 +0800 Subject: [PATCH] ci: add include to release --- .github/workflows/release_levilamina.yml | 12 ++++++-- scripts/make_include.py | 37 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 scripts/make_include.py diff --git a/.github/workflows/release_levilamina.yml b/.github/workflows/release_levilamina.yml index 6649ebdf98..f52d610db4 100644 --- a/.github/workflows/release_levilamina.yml +++ b/.github/workflows/release_levilamina.yml @@ -49,14 +49,20 @@ jobs: - uses: actions/download-artifact@v3 with: name: levilamina-windows-x64-${{ github.sha }} - path: bin + path: release/lib - run: | - cp CHANGELOG.md LICENSE.md README.md bin/ + python scripts/make_include.py + + - run: | + cp -r include release/ + + - run: | + cp CHANGELOG.md LICENSE.md README.md release/ - name: Archive release run: | - cd bin + cd release zip -r ../levilamina-windows-x64.zip * cd .. diff --git a/scripts/make_include.py b/scripts/make_include.py new file mode 100644 index 0000000000..9e97d39cb4 --- /dev/null +++ b/scripts/make_include.py @@ -0,0 +1,37 @@ +import os +import shutil + +# Get script directory +script_dir = os.path.dirname(os.path.realpath(__file__)) + +# Calculate source directory +source_dir = os.path.join(script_dir, "..", "src") + +# Calculate include directory +include_dir = os.path.join(script_dir, "..", "include") + +# Remove include directory +if os.path.exists(include_dir): + shutil.rmtree(include_dir) + +# Create include directory +os.mkdir(include_dir) + +# Copy all header files recursively +for root, dirs, files in os.walk(source_dir): + for file in files: + if file.endswith(".h"): + # Calculate source file path + source_file = os.path.join(root, file) + + # Calculate relative path + relative_path = os.path.relpath(source_file, source_dir) + + # Calculate include file path + include_file = os.path.join(include_dir, relative_path) + + # Create include directory + os.makedirs(os.path.dirname(include_file), exist_ok=True) + + # Copy file + shutil.copy(source_file, include_file)