name: Build/release

on:
  push:
    branches:
      - 'main'
      - 'master'

jobs:
  release:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [windows-latest, ubuntu-latest, macos-latest]

    steps:
      - name: Install Setuptools for Python
        run: pip3 install setuptools

      - name: Check out Git repository
        uses: actions/checkout@v3

      - name: Setup PNPM
        uses: pnpm/action-setup@v2.2.2
        with:
          version: 8.6.3

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: '16'
          cache: 'pnpm'

      - name: Install dependencies
        run: cd electron && pnpm install --frozen-lockfile

      - name: Build and Publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: cd electron && npm run publish
