name: Release

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

permissions:
  contents: write

jobs:
  release:
    strategy:
      fail-fast: false
      matrix:
        os:
          - windows-latest
          - macos-latest
          - ubuntu-latest
    
    runs-on: ${{ matrix.os }}
    
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0
          fetch-tags: true
          ref: ${{ github.ref }}
      
      - name: Setup pnpm
        uses: pnpm/action-setup@v6
        with:
          version: 11
      
      - name: Setup Node.js
        uses: actions/setup-node@v7
        with:
          node-version: 24.15.0
          registry-url: https://registry.npmjs.org/
          package-manager-cache: false
      
      - name: Install Deps
        run: |
          pnpm config list
          pnpm install --frozen-lockfile
      
      - name: Publish App
        run: pnpm exec electron-forge publish --no-git-checks
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      
      - name: Verify Output
        shell: bash
        run: |
          ls -R out
