name: Build and Release Electron App

on:
  push:
    tags:
      - v*.*.*

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

    strategy:
      matrix:
        os: [windows-latest]

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

      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install pnpm
        uses: pnpm/action-setup@v4
        with:
          version: 8

      - name: Install Dependencies
        run: pnpm install

      - name: Type check
        run: pnpm run typecheck

      - name: Lint and format check
        run: pnpm run check

      # - name: build-linux
      #   if: matrix.os == 'ubuntu-latest'
      #   run: pnpm run build:linux

      # - name: build-mac
      #   if: matrix.os == 'macos-latest'
      #   run: pnpm run build:mac

      - name: build-win
        if: matrix.os == 'windows-latest'
        run: pnpm run build:win

      - name: release
        uses: softprops/action-gh-release@v1
        with:
          draft: true
          files: |
            dist/*.exe
            dist/*.zip
            dist/*.dmg
            dist/*.AppImage
            dist/*.snap
            dist/*.deb
            dist/*.rpm
            dist/*.tar.gz
            dist/*.yml
            dist/*.blockmap
        env:
          GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

