Add standalone executable build system and GitHub Actions #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| artifact_name: android-bloatware-remover.exe | |
| asset_name: android-bloatware-remover-windows.exe | |
| - os: ubuntu-latest | |
| artifact_name: android-bloatware-remover | |
| asset_name: android-bloatware-remover-linux | |
| - os: macos-latest | |
| artifact_name: android-bloatware-remover | |
| asset_name: android-bloatware-remover-macos | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| - name: Create PyInstaller spec file | |
| run: | | |
| cat > android-bloatware-remover.spec << 'EOF' | |
| # -*- mode: python ; coding: utf-8 -*- | |
| block_cipher = None | |
| # Collect all brand directories and their contents | |
| brand_dirs = ['Samsung', 'Xiaomi', 'Oppo', 'Vivo', 'Realme', 'Tecno', 'OnePlus', 'Huawei', 'Honor', 'Motorola', 'Nothing'] | |
| datas = [] | |
| # Add brand directories | |
| for brand in brand_dirs: | |
| datas.append((f'{brand}/*.md', f'{brand}/')) | |
| datas.append((f'{brand}/*.py', f'{brand}/')) | |
| # Add core module | |
| datas.append(('core/*.py', 'core/')) | |
| # Add other files | |
| datas.append(('README.md', '.')) | |
| datas.append(('LICENSE', '.')) | |
| a = Analysis( | |
| ['main.py'], | |
| pathex=[], | |
| binaries=[], | |
| datas=datas, | |
| hiddenimports=[ | |
| 'Samsung.samsung_remover', | |
| 'Xiaomi.xiaomi_remover', | |
| 'Oppo.oppo_remover', | |
| 'Vivo.vivo_remover', | |
| 'Realme.realme_remover', | |
| 'Tecno.tecno_remover', | |
| 'OnePlus.oneplus_remover', | |
| 'Huawei.huawei_remover', | |
| 'Honor.honor_remover', | |
| 'Motorola.motorola_remover', | |
| 'Nothing.nothing_remover', | |
| 'core.bloatware_remover' | |
| ], | |
| hookspath=[], | |
| hooksconfig={}, | |
| runtime_hooks=[], | |
| excludes=[], | |
| win_no_prefer_redirects=False, | |
| win_private_assemblies=False, | |
| cipher=block_cipher, | |
| noarchive=False, | |
| ) | |
| pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | |
| exe = EXE( | |
| pyz, | |
| a.scripts, | |
| a.binaries, | |
| a.zipfiles, | |
| a.datas, | |
| [], | |
| name='android-bloatware-remover', | |
| debug=False, | |
| bootloader_ignore_signals=False, | |
| strip=False, | |
| upx=True, | |
| upx_exclude=[], | |
| runtime_tmpdir=None, | |
| console=True, | |
| disable_windowed_traceback=False, | |
| argv_emulation=False, | |
| target_arch=None, | |
| codesign_identity=None, | |
| entitlements_file=None, | |
| ) | |
| EOF | |
| - name: Build with PyInstaller | |
| run: | | |
| pyinstaller android-bloatware-remover.spec --clean | |
| - name: Test executable (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| dist/android-bloatware-remover.exe --test | |
| timeout-minutes: 2 | |
| - name: Test executable (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| chmod +x dist/android-bloatware-remover | |
| timeout 30s dist/android-bloatware-remover --test || true | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: dist/${{ matrix.artifact_name }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v3 | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| body: | | |
| ## Android Bloatware Remover ${{ github.ref }} | |
| Standalone executables for Windows, Linux, and macOS. | |
| ### Download Instructions: | |
| - **Windows**: Download `android-bloatware-remover-windows.exe` | |
| - **Linux**: Download `android-bloatware-remover-linux` | |
| - **macOS**: Download `android-bloatware-remover-macos` | |
| ### Usage: | |
| 1. Download the appropriate executable for your operating system | |
| 2. Make sure ADB is installed and in your PATH | |
| 3. Enable USB debugging on your Android device | |
| 4. Connect your device and run the executable | |
| ### Supported Devices: | |
| - Samsung (One UI) | |
| - Xiaomi/Redmi/POCO (MIUI) | |
| - Oppo (ColorOS) | |
| - Vivo/iQOO (FunTouch OS) | |
| - Realme (Realme UI) | |
| - Tecno (HiOS) | |
| - OnePlus (OxygenOS) | |
| - Huawei (EMUI/HarmonyOS) | |
| - Honor (Magic UI) | |
| - Motorola (My UX) | |
| - Nothing (Nothing OS) | |
| ### Test Mode: | |
| Run with `--test` flag to try without a connected device. | |
| draft: false | |
| prerelease: false | |
| - name: Upload Windows Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./android-bloatware-remover-windows.exe/android-bloatware-remover.exe | |
| asset_name: android-bloatware-remover-windows.exe | |
| asset_content_type: application/octet-stream | |
| - name: Upload Linux Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./android-bloatware-remover-linux/android-bloatware-remover | |
| asset_name: android-bloatware-remover-linux | |
| asset_content_type: application/octet-stream | |
| - name: Upload macOS Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./android-bloatware-remover-macos/android-bloatware-remover | |
| asset_name: android-bloatware-remover-macos | |
| asset_content_type: application/octet-stream |