Skip to content

Commit 2412e77

Browse files
committed
fix: use uv virtual environment for cross-platform builds
- Replace 'uv pip install --system' with 'uv sync' + 'uv run' - Avoid system Python permission issues on all platforms - Simplify matrix by removing redundant platform parameter - Use runner.os for platform detection - More reliable and consistent build process
1 parent d1c2d77 commit 2412e77

1 file changed

Lines changed: 17 additions & 25 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: ./.github/workflows/test.yml # Reuse the test workflow
1515

1616
build:
17-
name: Build ${{ matrix.platform }}
17+
name: Build ${{ matrix.os }}
1818
runs-on: ${{ matrix.os }}
1919
needs: test # Only build if tests pass
2020

@@ -23,33 +23,15 @@ jobs:
2323
include:
2424
# Windows
2525
- os: windows-latest
26-
platform: Windows
2726
output_name: pokemon-card-generator-windows.exe
28-
install_uv: pip install uv
29-
build_command: |
30-
uv sync
31-
uv run pip install pyinstaller
32-
uv run pyinstaller --onefile --name pokemon-card-generator main.py
3327

3428
# macOS (Apple Silicon)
3529
- os: macos-latest
36-
platform: macOS-ARM
3730
output_name: pokemon-card-generator-macos-arm
38-
install_uv: curl -LsSf https://astral.sh/uv/install.sh | sh
39-
build_command: |
40-
uv sync
41-
uv run pip install pyinstaller
42-
uv run pyinstaller --onefile --name pokemon-card-generator main.py
4331

4432
# Linux
4533
- os: ubuntu-latest
46-
platform: Linux
4734
output_name: pokemon-card-generator-linux
48-
install_uv: curl -LsSf https://astral.sh/uv/install.sh | sh
49-
build_command: |
50-
uv sync
51-
uv run pip install pyinstaller
52-
uv run pyinstaller --onefile --name pokemon-card-generator main.py
5335

5436
steps:
5537
- name: Checkout code
@@ -60,19 +42,29 @@ jobs:
6042
with:
6143
python-version: '3.11'
6244

63-
- name: Install uv
64-
run: ${{ matrix.install_uv }}
45+
- name: Install uv (Windows)
46+
if: runner.os == 'Windows'
47+
run: pip install uv
6548

66-
- name: Build executable
67-
run: ${{ matrix.build_command }}
49+
- name: Install uv (Unix)
50+
if: runner.os != 'Windows'
51+
run: |
52+
curl -LsSf https://astral.sh/uv/install.sh | sh
53+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
54+
55+
- name: Install dependencies and build
56+
run: |
57+
uv sync
58+
uv run pip install pyinstaller
59+
uv run pyinstaller --onefile --name pokemon-card-generator main.py
6860
6961
- name: Rename output (Windows)
70-
if: matrix.platform == 'Windows'
62+
if: runner.os == 'Windows'
7163
run: |
7264
Move-Item -Path "dist\pokemon-card-generator.exe" -Destination "dist\${{ matrix.output_name }}"
7365
7466
- name: Rename output (Unix)
75-
if: matrix.platform != 'Windows'
67+
if: runner.os != 'Windows'
7668
run: |
7769
mv dist/pokemon-card-generator "dist/${{ matrix.output_name }}"
7870

0 commit comments

Comments
 (0)