# .github/workflows/release.yml name: Release on: workflow_dispatch: jobs: release: runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest asset_name: android-file-handler-linux - os: windows-latest asset_name: android-file-handler-windows.exe steps: - uses: actions/checkout@v4 - name: Install AppImage dependencies (Linux) if: matrix.os == 'ubuntu-latest' run: | sudo apt update sudo apt install -y fuse libfuse2 curl imagemagick - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.13' - name: Install Poetry uses: snok/install-poetry@v1 with: version: latest virtualenvs-create: true virtualenvs-in-project: true - name: Cache build tools uses: actions/cache@v3 with: path: | python3.13.0-cp313-cp313-linux_x86_64.AppImage appimagetool key: build-tools-${{ matrix.os }} - name: Download python-appimage (Linux) if: matrix.os == 'ubuntu-latest' run: | curl -L -o python3.13.0-cp313-cp313-linux_x86_64.AppImage https://github.com/niess/python-appimage/releases/download/python3.13/python3.13.0-cp313-cp313-linux_x86_64.AppImage chmod +x python3.13.0-cp313-cp313-linux_x86_64.AppImage - name: Build AppImage (Linux) if: matrix.os == 'ubuntu-latest' run: | # 1. Extract Python AppImage first ./python3.13.0-cp313-cp313-linux_x86_64.AppImage --appimage-extract # 2. Create AppDir structure mkdir -p AppDir/usr/bin AppDir/usr/share/{applications,icons/hicolor/256x256/apps} mkdir -p AppDir/usr/lib/python3.13/site-packages # 3. Copy Python runtime to AppDir first cp -r squashfs-root/usr/* AppDir/usr/ # 4. Install dependencies using AppImage Python export PATH="$PWD/squashfs-root/usr/bin:$PATH" ./squashfs-root/usr/bin/python3 -m pip install poetry poetry install --no-dev # 5. Copy application source cp -r src/ AppDir/usr/bin/ # 6. Copy installed packages to AppDir cp -r .venv/lib/python3.13/site-packages/* AppDir/usr/lib/python3.13/site-packages/ 2>/dev/null || true # 7. Create AppRun script (after Python is available) cat > AppDir/AppRun << 'EOF' #!/bin/bash HERE="$(dirname "$(readlink -f "${0}")")" export APPDIR="$HERE" export PYTHONPATH="$HERE/usr/lib/python3.13/site-packages:$PYTHONPATH" exec "$HERE/usr/bin/python3" "$HERE/usr/bin/src/main.py" "$@" EOF chmod +x AppDir/AppRun # 8. Create .desktop file cat > AppDir/android-file-handler.desktop << 'EOF' [Desktop Entry] Type=Application Name=Android File Handler Exec=AppRun Icon=android-file-handler Categories=Utility; EOF # 9. Create icon convert -size 256x256 xc:lightblue -pointsize 48 -fill black -gravity center -annotate +0+0 "AFH" AppDir/usr/share/icons/hicolor/256x256/apps/android-file-handler.png || echo "Icon creation skipped" # 10. Download and setup appimagetool for attempt in 1 2 3; do curl -L -o appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage && break echo "Download attempt $attempt failed, retrying..." sleep 5 done chmod +x appimagetool # 11. Create AppImage directly in dist folder mkdir -p dist if ! ./appimagetool AppDir dist/android-file-handler-linux; then echo "AppImage creation failed" exit 1 fi - name: Build executable (Windows) if: matrix.os == 'windows-latest' run: | poetry lock poetry install poetry run pyinstaller --onefile src/main.py --distpath dist --name android-file-handler-windows - name: Create Release uses: softprops/action-gh-release@v1 with: files: dist/${{ matrix.asset_name }} generate_release_notes: true