226 lines
7.0 KiB
YAML
226 lines
7.0 KiB
YAML
name: Build Multi-Platform Binaries
|
|
|
|
on:
|
|
workflow_dispatch: # Manual trigger only
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
version: latest
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
poetry install
|
|
|
|
- name: Build Windows executable
|
|
run: |
|
|
poetry run pyinstaller --onefile --windowed --icon=icon_media/robot_files_256.ico --name android-file-handler src/main.py
|
|
|
|
- name: Upload Windows artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: windows-binary
|
|
path: dist/android-file-handler.exe
|
|
|
|
build-debian:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: python:3.12-slim
|
|
steps:
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl git build-essential
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
curl -sSL https://install.python-poetry.org | python -
|
|
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
|
|
|
|
- name: Configure Poetry
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry config virtualenvs.create true
|
|
poetry config virtualenvs.in-project true
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry env use python3.12 || true
|
|
poetry install
|
|
|
|
- name: Build Debian executable
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry run pyinstaller --onefile --icon=icon_media/robot_files_256.png --name android-file-handler src/main.py
|
|
|
|
- name: Upload Debian artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: debian-binary
|
|
path: dist/android-file-handler
|
|
|
|
build-arch:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: archlinux:latest
|
|
steps:
|
|
- name: Install system dependencies
|
|
run: |
|
|
pacman -Syu --noconfirm
|
|
pacman -S --noconfirm python python-pip curl git base-devel
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
curl -sSL https://install.python-poetry.org | python -
|
|
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
|
|
|
|
- name: Configure Poetry
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry config virtualenvs.create true
|
|
poetry config virtualenvs.in-project true
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry install
|
|
|
|
- name: Build Arch executable
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry run pyinstaller --onefile --icon=icon_media/robot_files_256.png --name android-file-handler src/main.py
|
|
|
|
- name: Upload Arch artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: arch-binary
|
|
path: dist/android-file-handler
|
|
|
|
build-rocky:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: rockylinux:9
|
|
steps:
|
|
- name: Install system build dependencies for Python and pyenv
|
|
run: |
|
|
# update metadata and install packages required to build CPython from source
|
|
dnf -y update
|
|
dnf -y install git gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel \
|
|
readline-devel sqlite-devel tk-devel gdbm-devel libuuid-devel patch
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pyenv and build Python 3.12.11 (native to Rocky)
|
|
env:
|
|
PYENV_ROOT: ${{ github.workspace }}/.pyenv_temp
|
|
run: |
|
|
# Use $HOME/.pyenv so we don't touch repository files; we will record the path via GITHUB_ENV
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
|
|
# Clone pyenv and python-build plugin
|
|
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
|
|
git clone https://github.com/pyenv/pyenv-build.git "$PYENV_ROOT/plugins/python-build"
|
|
|
|
# Persist pyenv environment for subsequent steps
|
|
echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
|
|
# prepend shims/bin to PATH so pyenv shims are available in later steps
|
|
echo "PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" >> $GITHUB_ENV
|
|
|
|
# Provide basic pyenv init for this step so we can run the pyenv binary immediately
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
eval "$($PYENV_ROOT/bin/pyenv init -)"
|
|
|
|
# Build and install specific Python version (specify the exact patch for reproducibility)
|
|
$PYENV_ROOT/bin/pyenv install -v 3.12.11
|
|
$PYENV_ROOT/bin/pyenv global 3.12.11
|
|
|
|
# Verify installed python
|
|
python --version
|
|
pip --version
|
|
|
|
- name: Install Poetry (use action; Poetry will use the pyenv-built python)
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
version: latest
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
|
|
- name: Configure Poetry
|
|
run: |
|
|
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry config virtualenvs.create true
|
|
poetry config virtualenvs.in-project true
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
# ensure poetry uses the pyenv python
|
|
poetry env use 3.12.11 || true
|
|
poetry install
|
|
|
|
- name: Build Rocky executable
|
|
run: |
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
poetry run pyinstaller --onefile --icon=icon_media/robot_files_256.png --name android-file-handler src/main.py
|
|
|
|
- name: Upload Rocky artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: rocky-binary
|
|
path: dist/android-file-handler
|
|
|
|
create-release:
|
|
needs: [build-windows, build-debian, build-arch, build-rocky]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
merge-multiple: true
|
|
path: ./binaries
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
./binaries/android-file-handler.exe
|
|
./binaries/android-file-handler
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |