Workflow: Streamline Windows build using /tmp for PyInstaller to fix path errors
This commit is contained in:
@@ -35,26 +35,21 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build Windows executable via Docker (Fixed Paths)
|
- name: Build Windows executable via Docker (Streamlined)
|
||||||
run: |
|
run: |
|
||||||
CONTAINER_NAME="builder-${{ github.run_id }}"
|
# Create output directory
|
||||||
docker rm -f $CONTAINER_NAME || true
|
|
||||||
|
|
||||||
# Create container
|
|
||||||
docker create --name $CONTAINER_NAME cdrx/pyinstaller-windows
|
|
||||||
|
|
||||||
# Copy code
|
|
||||||
docker cp . $CONTAINER_NAME:/src
|
|
||||||
|
|
||||||
# 1. Upgrade pyinstaller to fix the /tmp bug
|
|
||||||
# 2. Run pyinstaller with explicit local paths to avoid WinError 123
|
|
||||||
docker start -a $CONTAINER_NAME --attach --status || docker exec $CONTAINER_NAME sh -c "pip install --upgrade pyinstaller && cd /src && pyinstaller --onefile --name tamigo-cli --workpath /src/build --distpath /src/dist tamigo.py"
|
|
||||||
|
|
||||||
# Extract the result
|
|
||||||
mkdir -p output_dist
|
mkdir -p output_dist
|
||||||
docker cp $CONTAINER_NAME:/src/dist/tamigo-cli.exe ./output_dist/tamigo-cli.exe || docker cp $CONTAINER_NAME:/src/dist/windows/tamigo-cli.exe ./output_dist/tamigo-cli.exe || true
|
|
||||||
|
|
||||||
docker rm $CONTAINER_NAME
|
# Run the build in one clean shot using volume mount for simplicity since we are on ubuntu-latest
|
||||||
|
# We override the entrypoint to run our own shell script inside Wine/Windows environment
|
||||||
|
docker run --rm \
|
||||||
|
-v "${{ github.workspace }}:/src" \
|
||||||
|
-w /src \
|
||||||
|
cdrx/pyinstaller-windows \
|
||||||
|
sh -c "pip install --upgrade pyinstaller && pip install -r requirements.txt && pyinstaller --onefile --name tamigo-cli --workpath /tmp/build --distpath /tmp/dist tamigo.py && cp /tmp/dist/tamigo-cli.exe /src/tamigo-cli.exe"
|
||||||
|
|
||||||
|
# Move the result to our tracked folder
|
||||||
|
mv tamigo-cli.exe output_dist/ || echo "EXE not found in root"
|
||||||
|
|
||||||
- name: Debug - List local results
|
- name: Debug - List local results
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user