From 92da61802825fa28c172236f2e34c96bea70c37e Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 19 Oct 2024 17:27:50 +0900 Subject: [PATCH 1/4] fix: streamline build process by executing PyInstaller from project root and updating file paths --- .github/workflows/create-release.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 050bf43..c8286c8 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -92,22 +92,23 @@ jobs: - name: Compile for ${{ matrix.os }} run: | - cd src + # 直接在项目根目录下执行 PyInstaller pyinstaller --onefile sub_adjust.py pyinstaller --onefile sub_converter.py - cd .. + + # 移动编译后的文件到对应的 build 目录 if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then mkdir -p build/linux - mv src/dist/sub_adjust build/linux/ - mv src/dist/sub_converter build/linux/ + mv dist/sub_adjust build/linux/ + mv dist/sub_converter build/linux/ elif [ "${{ matrix.os }}" == "windows-latest" ]; then mkdir -p build/windows - mv src/dist/sub_adjust.exe build/windows/ - mv src/dist/sub_converter.exe build/windows/ + mv dist/sub_adjust.exe build/windows/ + mv dist/sub_converter.exe build/windows/ elif [ "${{ matrix.os }}" == "macos-latest" ]; then mkdir -p build/macos - mv src/dist/sub_adjust build/macos/ - mv src/dist/sub_converter build/macos/ + mv dist/sub_adjust build/macos/ + mv dist/sub_converter build/macos/ fi # Job 3: Create release From 4af11d88ea4bceebc4a9f03aa53b0e48a89e154a Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 19 Oct 2024 17:32:11 +0900 Subject: [PATCH 2/4] fix: allow synchronization events for pull requests in release workflow --- .github/workflows/create-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index c8286c8..59fdfc7 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -2,9 +2,10 @@ name: Create Tag and Release on: pull_request: - types: [closed] + types: [closed, synchronize] branches: - main + - 1.2.0-release-2 concurrency: group: create-tag-and-release-${{ github.ref }} From 0ef235bad182c2022d9b21d082ce0c162a289f2f Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 19 Oct 2024 17:34:15 +0900 Subject: [PATCH 3/4] fix: comment out condition for PR merge validation in release workflow --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 59fdfc7..b5f75f9 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -14,7 +14,7 @@ concurrency: jobs: # Job 1: Validate the PR and extract version validate_and_tag: - if: github.event.pull_request.merged == true + # if: github.event.pull_request.merged == true runs-on: ubuntu-latest outputs: From 595b046d65035946179e39f7d394441c92dc0304 Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 19 Oct 2024 17:43:08 +0900 Subject: [PATCH 4/4] fix: enhance dependency installation and compilation steps for cross-platform support in release workflow --- .github/workflows/create-release.yml | 35 ++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index b5f75f9..1813f1f 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -82,16 +82,27 @@ jobs: architecture: ${{ matrix.architecture || '' }} - name: Install Dependencies + if: runner.os != 'Windows' run: | - if [ -f src/requirements.txt ]; then - pip install -r src/requirements.txt + if [ -f requirements.txt ]; then + pip install -r requirements.txt fi + shell: bash + + - name: Install Dependencies (Windows) + if: runner.os == 'Windows' + run: | + if (Test-Path -Path requirements.txt) { + pip install -r requirements.txt + } + shell: pwsh - name: Install PyInstaller run: | pip install pyinstaller - - name: Compile for ${{ matrix.os }} + - name: Compile for Linux and macOS + if: runner.os != 'Windows' run: | # 直接在项目根目录下执行 PyInstaller pyinstaller --onefile sub_adjust.py @@ -102,15 +113,25 @@ jobs: mkdir -p build/linux mv dist/sub_adjust build/linux/ mv dist/sub_converter build/linux/ - elif [ "${{ matrix.os }}" == "windows-latest" ]; then - mkdir -p build/windows - mv dist/sub_adjust.exe build/windows/ - mv dist/sub_converter.exe build/windows/ elif [ "${{ matrix.os }}" == "macos-latest" ]; then mkdir -p build/macos mv dist/sub_adjust build/macos/ mv dist/sub_converter build/macos/ fi + shell: bash + + - name: Compile for Windows + if: runner.os == 'Windows' + run: | + # 直接在项目根目录下执行 PyInstaller + pyinstaller --onefile sub_adjust.py + pyinstaller --onefile sub_converter.py + + # 移动编译后的文件到对应的 build 目录 + mkdir -p build/windows + mv dist/sub_adjust.exe build/windows/ + mv dist/sub_converter.exe build/windows/ + shell: pwsh # Job 3: Create release create_release: