Fix node-gyp distutils: use Python 3.11 via setup-python + npm_config… #57
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 | |
| # Triggered by pushing a version tag: git tag v1.0.0 && git push --tags | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: # allow manual runs from the Actions tab | |
| permissions: | |
| contents: write # needed to create/upload release assets | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| platform: linux | |
| - os: windows-latest | |
| platform: windows | |
| - os: macos-13 # Intel (x86_64) | |
| platform: macos-intel | |
| - os: macos-latest # Apple Silicon (arm64) | |
| platform: macos-arm | |
| runs-on: ${{ matrix.os }} | |
| name: Build (${{ matrix.platform }}) | |
| steps: | |
| # ── Checkout ──────────────────────────────────────────────────────────── | |
| - uses: actions/checkout@v4 | |
| # ── Node.js ───────────────────────────────────────────────────────────── | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: electron/package-lock.json | |
| # ── Linux: system libs required by Electron / AppImage ────────────────── | |
| - name: Install Linux system deps | |
| if: matrix.platform == 'linux' | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends \ | |
| libgtk-3-dev libglib2.0-dev fuse libfuse2 rpm | |
| # ── Python 3.11 for node-gyp ───────────────────────────────────────────── | |
| # distutils was removed in Python 3.12. node-gyp (used to rebuild | |
| # node-pty) still needs it. Using Python 3.11 avoids the issue entirely. | |
| # npm_config_python tells node-gyp exactly which Python to use. | |
| - name: Set up Python 3.11 for node-gyp | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| # ── Install npm dependencies ───────────────────────────────────────────── | |
| - name: Install npm dependencies | |
| working-directory: electron | |
| run: npm install | |
| env: | |
| npm_config_python: python | |
| # ── Build ──────────────────────────────────────────────────────────────── | |
| - name: Build (Linux) | |
| if: matrix.platform == 'linux' | |
| working-directory: electron | |
| run: npm run build-linux | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| npm_config_python: python | |
| - name: Build (Windows) | |
| if: matrix.platform == 'windows' | |
| working-directory: electron | |
| run: npm run build-win | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| npm_config_python: python | |
| - name: Build (macOS Intel) | |
| if: matrix.platform == 'macos-intel' | |
| working-directory: electron | |
| run: npm run build-mac | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| npm_config_python: python | |
| - name: Build (macOS ARM) | |
| if: matrix.platform == 'macos-arm' | |
| working-directory: electron | |
| run: npm run build-mac | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| npm_config_python: python | |
| # ── Upload artifact for debugging ──────────────────────────────────────── | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ matrix.platform }} | |
| path: | | |
| electron/dist/*.AppImage | |
| electron/dist/*.exe | |
| electron/dist/*.dmg | |
| electron/dist/*.zip | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| # ── Attach to GitHub Release ───────────────────────────────────────────── | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| electron/dist/*.AppImage | |
| electron/dist/*.exe | |
| electron/dist/*.dmg | |
| electron/dist/*.zip | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |