From 9c2b55488f247e5ab31feb91cb602400e4cd7c5e Mon Sep 17 00:00:00 2001 From: zoe Date: Tue, 17 Sep 2024 11:30:21 +0200 Subject: [PATCH] add prefix script --- .github/workflows/build.yaml | 6 +++--- add_release_prefix.py | 12 ++++++++++++ rename_release_files_windows.py | 18 ------------------ 3 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 add_release_prefix.py delete mode 100644 rename_release_files_windows.py diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ff1da90..a6d4745 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,10 +13,10 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: build binary run: cargo xtask bundle -p x_fader - - name: add file extension - run: python3 rename_release_files_windows.py + - name: add release prefix + run: python3 add_release_prefix.py windows_ - uses: ncipollo/release-action@v1 with: - artifacts: ".\target\bundled\\*" + artifacts: '.\target\bundled\*' allowUpdates: true tag: "release" \ No newline at end of file diff --git a/add_release_prefix.py b/add_release_prefix.py new file mode 100644 index 0000000..a016294 --- /dev/null +++ b/add_release_prefix.py @@ -0,0 +1,12 @@ +import os +import sys + +directory = os.path.join("target", "bundled") +prefix = sys.argv[0] + +for filename in os.listdir(directory): + old_file = os.path.join(directory) + new_file = os.path.join(directory, prefix + filename) + os.rename(old_file, new_file) + +print(f"Prefix '{prefix}' added to release files") diff --git a/rename_release_files_windows.py b/rename_release_files_windows.py deleted file mode 100644 index 12d5cbe..0000000 --- a/rename_release_files_windows.py +++ /dev/null @@ -1,18 +0,0 @@ -import os - -# Define the directory where the files are located and the prefix to add -directory = '\target\bundled' # Update with your directory -prefix = 'windows_' # The prefix you want to add - -# Loop through all files in the directory -for filename in os.listdir(directory): - old_file = os.path.join(directory, filename) - - # Check if it's a file (not a directory or other type) - if os.path.isfile(old_file): - new_file = os.path.join(directory, prefix + filename) - - # Rename the file - os.rename(old_file, new_file) - -print(f"Prefix '{prefix}' added to all files.")