Skip to content

Commit

Permalink
fix: enhance dependency installation and compilation steps for cross-…
Browse files Browse the repository at this point in the history
…platform support in release workflow
  • Loading branch information
thelastfantasy committed Oct 19, 2024
1 parent 0ef235b commit 595b046
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 595b046

Please sign in to comment.