Update build.yml #216
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
| name: Build/Release | |
| # on: push | |
| on: | |
| # only on tags which follow semantic versioning | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build-release: | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| arch: [x64, arm64] | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v1 | |
| - name: Set Up Python arm64 | |
| if: matrix.arch == 'arm64' | |
| id: setup-python-arm64 | |
| run: | | |
| curl -O -L https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg | |
| sudo installer -pkg python-3.9.13-macos11.pkg -target / | |
| cd .. | |
| - name: Set Up Python x64 | |
| if: matrix.arch == 'x64' | |
| id: setup-python-x64 | |
| run: | | |
| curl -O -L https://www.python.org/ftp/python/3.9.13/python-3.9.13-macosx10.9.pkg | |
| sudo installer -pkg python-3.9.13-macosx10.9.pkg -target / | |
| cd .. | |
| - name: Install backend dependencies | |
| id: install-backend-deps | |
| run: | | |
| cd backend | |
| python3.9 -m pip install build | |
| python3.9 -m 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.arch == 'arm64' | |
| run: | | |
| cd backend | |
| pyinstaller build_mac_arm64.spec | |
| - name: Build backend executable x64 | |
| id: build-backend-x64 | |
| if: matrix.arch == 'x64' | |
| 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.arch == 'x64' && '--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')) }} |