Workflow: Use True Windows Python inside Wine to generate actual EXE
This commit is contained in:
@@ -35,30 +35,41 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build Windows executable (Self-Built Environment)
|
- name: Build Windows executable (True Cross-Compile)
|
||||||
run: |
|
run: |
|
||||||
# 1. Create a local Dockerfile with ALL necessary tools
|
# 1. Create a local Dockerfile that installs Windows Python under Wine
|
||||||
cat <<EOF > Dockerfile.win
|
cat <<EOF > Dockerfile.win
|
||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
||||||
# objdump is in binutils, wine-tools/binutils-mingw are needed for cross-compiling
|
|
||||||
RUN apt-get update && \
|
# Install Wine and dependencies
|
||||||
apt-get install -y binutils wine binutils-mingw-w64-x86-64 && \
|
RUN dpkg --add-architecture i386 && apt-get update && \
|
||||||
|
apt-get install -y wine wine32 wine64 wget && \
|
||||||
apt-get clean
|
apt-get clean
|
||||||
RUN python -m pip install --upgrade pip pyinstaller requests questionary rich python-dotenv
|
|
||||||
|
# Install Windows Python inside Wine
|
||||||
|
RUN wget https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe && \
|
||||||
|
wine python-3.10.11-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 && \
|
||||||
|
rm python-3.10.11-amd64.exe
|
||||||
|
|
||||||
|
# Install dependencies inside Windows Python
|
||||||
|
RUN wine python -m pip install --upgrade pip
|
||||||
|
RUN wine python -m pip install pyinstaller requests questionary rich python-dotenv
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 2. Build local image (force fresh build)
|
# 2. Build local image
|
||||||
docker build -t local-win-builder -f Dockerfile.win .
|
docker build -t true-win-builder -f Dockerfile.win .
|
||||||
|
|
||||||
# 3. Use unique container name
|
# 3. Use unique container name
|
||||||
CONTAINER_NAME="win-build-${{ github.run_id }}"
|
CONTAINER_NAME="win-build-${{ github.run_id }}"
|
||||||
|
|
||||||
docker create --name $CONTAINER_NAME local-win-builder sh -c "pyinstaller --onefile --name tamigo-cli tamigo.py"
|
# 4. Run build using the Windows Python interpreter
|
||||||
|
docker create --name $CONTAINER_NAME true-win-builder wine python -m PyInstaller --onefile --name tamigo-cli tamigo.py
|
||||||
docker cp . $CONTAINER_NAME:/src
|
docker cp . $CONTAINER_NAME:/src
|
||||||
|
|
||||||
# 4. Start build and extract
|
|
||||||
docker start -a $CONTAINER_NAME
|
docker start -a $CONTAINER_NAME
|
||||||
|
|
||||||
|
# 5. Extract and cleanup
|
||||||
mkdir -p win_dist
|
mkdir -p win_dist
|
||||||
docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/
|
docker cp $CONTAINER_NAME:/src/dist/. ./win_dist/
|
||||||
docker rm $CONTAINER_NAME
|
docker rm $CONTAINER_NAME
|
||||||
|
|||||||
Reference in New Issue
Block a user