Build Standalone Application #26
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 Standalone Application | |
| on: | |
| # Manual trigger | |
| workflow_dispatch: | |
| # Key: Give GITHUB_TOKEN write permissions (contents: write), otherwise unable to create releases | |
| permissions: | |
| contents: write | |
| jobs: | |
| build_and_release: | |
| runs-on: macos-latest | |
| steps: | |
| # 1. Check out repository code | |
| - name: Check out repository | |
| uses: actions/checkout@v2 | |
| # 2. Set up Python 3.9 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.9' | |
| # 3. Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install py2app | |
| # Install librsvg for SVG conversion | |
| brew install librsvg | |
| # 4. Create app icon from SVG | |
| - name: Create app icon from SVG | |
| run: | | |
| # Create different sizes of PNG | |
| rsvg-convert -w 16 -h 16 icon.svg -o icon_16x16.png | |
| rsvg-convert -w 32 -h 32 icon.svg -o icon_32x32.png | |
| rsvg-convert -w 64 -h 64 icon.svg -o icon_64x64.png | |
| rsvg-convert -w 128 -h 128 icon.svg -o icon_128x128.png | |
| rsvg-convert -w 256 -h 256 icon.svg -o icon_256x256.png | |
| rsvg-convert -w 512 -h 512 icon.svg -o icon_512x512.png | |
| rsvg-convert -w 1024 -h 1024 icon.svg -o icon_1024x1024.png | |
| # Create iconset directory structure | |
| mkdir icon.iconset | |
| cp icon_16x16.png icon.iconset/icon_16x16.png | |
| cp icon_32x32.png icon.iconset/icon_16x16@2x.png | |
| cp icon_32x32.png icon.iconset/icon_32x32.png | |
| cp icon_64x64.png icon.iconset/icon_32x32@2x.png | |
| cp icon_128x128.png icon.iconset/icon_128x128.png | |
| cp icon_256x256.png icon.iconset/icon_128x128@2x.png | |
| cp icon_256x256.png icon.iconset/icon_256x256.png | |
| cp icon_512x512.png icon.iconset/icon_256x256@2x.png | |
| cp icon_512x512.png icon.iconset/icon_512x512.png | |
| cp icon_1024x1024.png icon.iconset/icon_512x512@2x.png | |
| # Use iconutil to create .icns file | |
| iconutil -c icns icon.iconset | |
| # Verify icon file creation success | |
| ls -la icon.icns | |
| # 5. Create setup.py configuration file | |
| - name: Create setup.py for py2app | |
| run: | | |
| cat > setup.py << 'EOF' | |
| from setuptools import setup | |
| APP = ['everything.py'] | |
| DATA_FILES = [ | |
| ('', ['LICENSE.md', 'README.md']), | |
| ] | |
| OPTIONS = { | |
| 'argv_emulation': False, | |
| 'packages': ['PyQt6'], | |
| 'excludes': [], | |
| 'iconfile': 'icon.icns', | |
| 'plist': { | |
| 'CFBundleName': 'Everything', | |
| 'CFBundleDisplayName': 'Everything', | |
| 'CFBundleVersion': '1.3.6', | |
| 'CFBundleShortVersionString': '1.3.6', | |
| 'CFBundleIdentifier': 'com.appledragon.everythingbymdfind', | |
| 'LSMinimumSystemVersion': '10.14', | |
| 'NSHighResolutionCapable': True, | |
| } | |
| } | |
| setup( | |
| app=APP, | |
| data_files=DATA_FILES, | |
| options={'py2app': OPTIONS}, | |
| setup_requires=['py2app'], | |
| ) | |
| EOF | |
| # 6. Build universal application | |
| - name: Build universal application | |
| run: | | |
| # Clean previous builds | |
| rm -rf build dist | |
| # Build universal version (supports both x86_64 and arm64) | |
| python setup.py py2app --arch universal2 | |
| # Create archive | |
| cd dist | |
| zip -r ../everything.zip "Everything.app" | |
| cd .. | |
| # 7. Create GitHub Release | |
| - name: Create GitHub release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: 'v1.3.6' | |
| release_name: 'v1.3.6' | |
| draft: false | |
| prerelease: false | |
| # 8. Upload release asset | |
| - name: Upload 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: everything.zip | |
| asset_name: everything.zip | |
| asset_content_type: application/zip |