.github/workflows/ci.yml

name: CI

on:
  pull_request:
  push:
    branches: [main]
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  build:
    name: Test and package (${{ matrix.platform }})
    runs-on: ${{ matrix.runner }}
    timeout-minutes: 20
    strategy:
      fail-fast: false
      matrix:
        include:
          - platform: windows-x64
            runner: windows-latest
            args: --win nsis --x64
            artifact: release/*.exe
          - platform: macos-arm64
            runner: macos-15
            args: --mac dmg --arm64
            artifact: release/*.dmg
          - platform: macos-x64
            runner: macos-15-intel
            args: --mac dmg --x64
            artifact: release/*.dmg
          - platform: linux-x64
            runner: ubuntu-24.04
            args: --linux AppImage --x64
            artifact: release/*.AppImage
    env:
      CSC_IDENTITY_AUTO_DISCOVERY: "false"
    steps:
      - uses: actions/checkout@v5
        with:
          persist-credentials: false
      - uses: actions/setup-node@v5
        with:
          node-version: 24
          cache: npm
      - run: npm ci --no-audit --no-fund
      - run: npm test
      - run: npm run build
      - name: Create installer
        run: npx --no-install electron-builder ${{ matrix.args }} --publish never
      - name: Upload installer
        uses: actions/upload-artifact@v5
        with:
          name: installer-${{ matrix.platform }}
          path: ${{ matrix.artifact }}
          if-no-files-found: error
          retention-days: 1
          compression-level: 0