Create macOS binary #53
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
| # Checks BiaPy code consistency | |
| name: Create macOS binary | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| jobs: | |
| run: | |
| runs-on: macos-14 | |
| # runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" # caching pip dependencies | |
| - name: Installing BiaPy-GUI dependencies | |
| run: pip install -r requirements.txt | |
| - name: Creating macOS binary | |
| run: | | |
| cp dist-macOS/main.spec main.spec | |
| pyinstaller main.spec | |
| - name: Check dist folder contents | |
| run: | | |
| echo "== dist tree ==" | |
| ls -R dist || true | |
| - name: Decode creds and show service account email (for debugging only) | |
| run: | | |
| echo "$DRIVE_CREDENTIALS" | base64 -d > sa.json | |
| jq -r '.client_email,.project_id' sa.json | |
| rm -f sa.json | |
| - name: Upload dist/BiaPy to Drive | |
| env: | |
| FOLDER_ID: 1vMFX1llrQ7FDiMriMCFgqObfCHlOCcWM | |
| run: | | |
| echo "$DRIVE_CREDENTIALS" | base64 -d > sa.json | |
| python - <<'PY' | |
| import os, sys, mimetypes | |
| from google.oauth2.service_account import Credentials | |
| from googleapiclient.discovery import build | |
| from googleapiclient.http import MediaFileUpload | |
| creds = Credentials.from_service_account_file('sa.json', scopes=['https://www.googleapis.com/auth/drive']) | |
| drive = build('drive','v3',credentials=creds,cache_discovery=False) | |
| path = 'dist/BiaPy.app' | |
| name = os.path.basename(path.rstrip('/')) | |
| media = MediaFileUpload(path, mimetype=mimetypes.guess_type(path)[0] or 'application/octet-stream', resumable=True) | |
| file_metadata = {'name': name, 'parents': [os.environ['FOLDER_ID']]} | |
| file = drive.files().create(body=file_metadata, media_body=media, fields='id,name').execute() | |
| print("Uploaded:", file['name'], file['id']) | |
| PY |