Build macOS App #5
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 macOS App | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: Build macOS app using spec file | |
| run: | | |
| pyinstaller DrugCalculator-macos.spec | |
| - name: Verify build | |
| run: | | |
| echo "Checking dist/ directory..." | |
| ls -la dist/ | |
| if [ -d "dist/DrugCalculator.app" ]; then | |
| echo "✅ App bundle created successfully" | |
| du -sh dist/DrugCalculator.app | |
| echo "Contents:" | |
| ls -la dist/DrugCalculator.app/Contents/MacOS/ | |
| else | |
| echo "❌ App bundle not found" | |
| exit 1 | |
| fi | |
| - name: Create DMG installer | |
| if: github.event_name != 'pull_request' # Skip for PRs | |
| run: | | |
| # Install create-dmg | |
| brew install create-dmg | |
| # Create DMG installer | |
| create-dmg \ | |
| --volname "Drug Calculator" \ | |
| --window-pos 200 120 \ | |
| --window-size 600 400 \ | |
| --icon-size 100 \ | |
| --app-drop-link 425 120 \ | |
| --no-internet-enable \ | |
| "DrugCalculator-v2.1.1-macOS.dmg" \ | |
| "dist/DrugCalculator.app" | |
| - name: Upload app bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DrugCalculator-macOS-app | |
| path: dist/DrugCalculator.app | |
| retention-days: 30 | |
| - name: Upload DMG | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DrugCalculator-macOS-dmg | |
| path: "*.dmg" | |
| retention-days: 30 |