Workflow: Fix Windows build WinError 123 by upgrading PyInstaller and using explicit paths
This commit is contained in:
@@ -35,41 +35,30 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build Windows executable via Docker (Discovery Mode)
|
- name: Build Windows executable via Docker (Fixed Paths)
|
||||||
run: |
|
run: |
|
||||||
CONTAINER_NAME="builder-${{ github.run_id }}"
|
CONTAINER_NAME="builder-${{ github.run_id }}"
|
||||||
docker rm -f $CONTAINER_NAME || true
|
docker rm -f $CONTAINER_NAME || true
|
||||||
|
|
||||||
# 1. Create the container
|
# Create container
|
||||||
docker create --name $CONTAINER_NAME cdrx/pyinstaller-windows
|
docker create --name $CONTAINER_NAME cdrx/pyinstaller-windows
|
||||||
|
|
||||||
# 2. Copy the source code in
|
# Copy code
|
||||||
docker cp . $CONTAINER_NAME:/src
|
docker cp . $CONTAINER_NAME:/src
|
||||||
|
|
||||||
# 3. Start the build
|
# 1. Upgrade pyinstaller to fix the /tmp bug
|
||||||
docker start -a $CONTAINER_NAME || echo "Build process finished with some output"
|
# 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
|
# Extract the result
|
||||||
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
|
|
||||||
mkdir -p output_dist
|
mkdir -p output_dist
|
||||||
if [ -n "$EXE_PATH" ]; then
|
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 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
|
|
||||||
|
|
||||||
# 6. Clean up
|
|
||||||
docker rm $CONTAINER_NAME
|
docker rm $CONTAINER_NAME
|
||||||
|
|
||||||
- name: Debug - List local results
|
- name: Debug - List local results
|
||||||
run: |
|
run: |
|
||||||
ls -R output_dist/ || echo "output_dist not found"
|
ls -R output_dist/ || echo "output_dist not found"
|
||||||
find . -name "*.exe"
|
|
||||||
|
|
||||||
- name: Upload Windows Artifact
|
- name: Upload Windows Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|||||||
Reference in New Issue
Block a user