Skip to content

Version 1.2.0

Version 1.2.0 #38

# Checks BiaPy code consistency
name: Create Windows binary
on:
workflow_dispatch:
release:
types: [published]
jobs:
run:
runs-on: windows-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 Windows binary
run: |
cp dist-win/main.spec main.spec
pyinstaller.exe main.spec
- name: Check dist folder contents
run: |
echo "== dist tree =="
ls -R dist || true
- 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"
# 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