Build Application #20
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 Application | |
| on: | |
| release: | |
| types: [published] # Only trigger on published releases | |
| workflow_dispatch: # Allow manual triggering | |
| # Add global permissions | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| pip install . | |
| - name: Build with PyInstaller | |
| run: | | |
| pyinstaller --windowed --icon=gui/Logo_PyNutil.ico --name PyNutil gui/PyNutilGUI.py | |
| - name: Create Windows ZIP archive | |
| run: | | |
| cd dist | |
| powershell Compress-Archive -Path PyNutil -DestinationPath PyNutil-Windows.zip | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PyNutil-Windows | |
| path: dist/PyNutil-Windows.zip | |
| retention-days: 5 | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| pip install dmgbuild | |
| pip install . | |
| - name: Build with PyInstaller | |
| run: | | |
| # Build without specifying an icon for macOS to avoid format issues | |
| pyinstaller --windowed --osx-bundle-identifier com.pynutil.app --name PyNutil gui/PyNutilGUI.py | |
| - name: Create DMG | |
| run: | | |
| pip install dmgbuild | |
| cat > dmg_settings.py << EOF | |
| app = 'dist/PyNutil.app' | |
| appname = 'PyNutil' | |
| format = 'UDBZ' | |
| size = '500M' | |
| files = [app] | |
| symlinks = {'Applications': '/Applications'} | |
| # Remove badge_icon to avoid icon format issues | |
| icon_locations = { | |
| appname + '.app': (140, 120), | |
| 'Applications': (360, 120) | |
| } | |
| background = 'builtin-arrow' | |
| EOF | |
| dmgbuild -s dmg_settings.py "PyNutil" "dist/PyNutil-macOS.dmg" || true | |
| - name: Upload DMG artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PyNutil-macOS | |
| path: dist/PyNutil-macOS.dmg | |
| retention-days: 5 | |
| create-release: | |
| needs: [build-windows, build-macos] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: List downloaded artifacts | |
| run: | | |
| find . -type f | sort | |
| - name: Attach Artifacts to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| PyNutil-Windows/PyNutil-Windows.zip | |
| PyNutil-macOS/PyNutil-macOS.dmg | |
| token: ${{ github.token }} |