Skip to content

Update build.yml

Update build.yml #197

Workflow file for this run

name: Build/Release
on: push
# on:
# # only on tags which follow semantic versioning
# push:
# tags:
# - "v*"
jobs:
build-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, macos-13]
steps:
- name: Check out Git repository
uses: actions/checkout@v1
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.9
# - name: Install miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# python-version: 3.9
# - name: Set up Python
# run: |
# conda create -qyf py39 python=3.9 wheel -c anaconda
# conda activate py39
# python setup.py sdist bdist_wheel
# shell: bash -l {0}
- name: Set up Python
id: setup-python
run: |
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
MACOSX_DEPLOYMENT_TARGET=10.9 pyenv install 3.9.21
pyenv local 3.9.21
- name: Install backend dependencies
id: install-backend-deps
run: |
cd backend
pip install build
pip install -U -r requirements.txt
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install frontend dependencies
id: install-frontend-deps
run: |
cd electron
npm i --yes
- name: Create backend env.py
id: create-backend-env
run: |
cd backend
touch env.py
echo "import os" >> env.py
echo 'os.environ["STORAGE_KEY"] = "${{ secrets.STORAGE_KEY }}"' >> env.py
echo 'os.environ["SUPABASE_URL"] = "${{ secrets.SUPABASE_URL }}"' >> env.py
echo 'os.environ["SUPABASE_KEY"] = "${{ secrets.SUPABASE_KEY }}"' >> env.py
- name: Build backend executable arm64
id: build-backend-arm64
if: matrix.os == 'macos-latest'
run: |
cd backend
pyinstaller build_mac_arm64.spec
- name: Build backend executable x64
id: build-backend-x64
if: matrix.os == 'macos-13'
run: |
cd backend
pyinstaller build_mac_x64.spec
- name: Prepare for app notarization
if: startsWith(matrix.os, 'macos')
# Import Apple API key for app notarization on macOS
run: |
mkdir -p ~/private_keys/
echo "${{ secrets.MAC_API_KEY }}" > ~/private_keys/AuthKey_${{ secrets.MAC_API_KEY_ID }}.p8
- name: Build/release Electron app
uses: codeofandrin/action-electron-builder@master
with:
package_root: ./electron
build_script_name: prebuild
args: ${{ matrix.os == 'macos-13' && '--x64' || '--arm64' }}
skip_sign: ${{ !(startsWith(github.ref, 'refs/tags/v')) }}
# GitHub tokens
github_token: ${{ secrets.GH_TOKEN }}
# macOS code signing certificate
mac_certs: ${{ secrets.MAC_CERTS }}
mac_certs_password: ${{ secrets.MAC_CERTS_PASSWORD }}
# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
# macOS Notarization
MAC_API_KEY_ID: ${{ secrets.MAC_API_KEY_ID }}
MAC_API_KEY_ISSUER_ID: ${{ secrets.MAC_API_KEY_ISSUER_ID }}
SKIP_NOTARIZE: ${{ !(startsWith(github.ref, 'refs/tags/v')) }}