.github/workflows/release.yml

name: Build installer

on:
  push:
    tags: ["v*"]
  workflow_dispatch:

permissions:
  contents: write

jobs:
  windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v5
        with:
          node-version: 24
          cache: npm
      - run: npm ci
      - run: npm test
      - run: npm run package
      - uses: actions/upload-artifact@v5
        with:
          name: installer
          path: release/*.exe
          if-no-files-found: error
      - name: Publish the release
        if: startsWith(github.ref, 'refs/tags/v')
        shell: bash
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          gh release create "${GITHUB_REF_NAME}" \
            release/*.exe release/*.blockmap \
            --title "${GITHUB_REF_NAME}" \
            --generate-notes