Skip to content

Create macOS binary #55

Create macOS binary

Create macOS binary #55

# 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
- name: Upload dist/BiaPy to Google Drive (Python method)
env:
FOLDER_ID: ${{ secrets.FOLDER_FOR_NEW_BINARIES }}
run: |
# Install Google API client
python -m pip install --quiet google-api-python-client google-auth google-auth-httplib2 google-auth-oauthlib
# Decode your base64 credentials into a JSON file
echo "${{ secrets.DRIVE_CREDENTIALS }}" | base64 -d > sa.json
# Run the upload script
python - <<'PY'
import os, mimetypes
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
FOLDER_ID = os.environ["FOLDER_ID"]
PATH = "dist/BiaPy.app"
# Authorize with service account
creds = Credentials.from_service_account_file(
"sa.json",
scopes=["https://www.googleapis.com/auth/drive"]
)
service = build("drive", "v3", credentials=creds, cache_discovery=False)
# Upload file (or folder as zip)
name = os.path.basename(PATH.rstrip("/"))
mime_type = mimetypes.guess_type(PATH)[0] or "application/octet-stream"
media = MediaFileUpload(PATH, mimetype=mime_type, resumable=True)
file_metadata = {"name": name, "parents": [FOLDER_ID]}
print(f"Uploading {PATH} to folder {FOLDER_ID} ...")
file = service.files().create(body=file_metadata, media_body=media, fields="id,name").execute()
print(f"✅ Uploaded {file['name']} with id {file['id']}")
PY