Workflow: Fix Windows build WinError 123 by upgrading PyInstaller and using explicit paths
This commit is contained in:
@@ -35,41 +35,30 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build Windows executable via Docker (Discovery Mode)
|
||||
- name: Build Windows executable via Docker (Fixed Paths)
|
||||
run: |
|
||||
CONTAINER_NAME="builder-${{ github.run_id }}"
|
||||
docker rm -f $CONTAINER_NAME || true
|
||||
|
||||
# 1. Create the container
|
||||
# Create container
|
||||
docker create --name $CONTAINER_NAME cdrx/pyinstaller-windows
|
||||
|
||||
# 2. Copy the source code in
|
||||
# Copy code
|
||||
docker cp . $CONTAINER_NAME:/src
|
||||
|
||||
# 3. Start the build
|
||||
docker start -a $CONTAINER_NAME || echo "Build process finished with some output"
|
||||
# 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"
|
||||
|
||||
# 4. DISCOVERY: Find where the .exe actually ended up inside the container
|
||||
echo "Searching for .exe inside container..."
|
||||
EXE_PATH=$(docker exec $CONTAINER_NAME find /src -name "*.exe" | head -n 1)
|
||||
echo "Found EXE at: $EXE_PATH"
|
||||
|
||||
# 5. Extract the entire dist folder or the specific file
|
||||
# Extract the result
|
||||
mkdir -p output_dist
|
||||
if [ -n "$EXE_PATH" ]; then
|
||||
docker cp $CONTAINER_NAME:$EXE_PATH ./output_dist/tamigo-cli.exe
|
||||
else
|
||||
echo "Falling back to copying /src/dist..."
|
||||
docker cp $CONTAINER_NAME:/src/dist ./output_dist || echo "Final fallback failed"
|
||||
fi
|
||||
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
|
||||
|
||||
# 6. Clean up
|
||||
docker rm $CONTAINER_NAME
|
||||
|
||||
- name: Debug - List local results
|
||||
run: |
|
||||
ls -R output_dist/ || echo "output_dist not found"
|
||||
find . -name "*.exe"
|
||||
|
||||
- name: Upload Windows Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
Reference in New Issue
Block a user