summaryrefslogtreecommitdiff
path: root/.github/workflows/release-windows.yml
blob: 81c2e3d7f5e0a0fc81bb8dff41a3d6dd6784d3a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Builds the Windows installer on a Windows runner (node-pty must be
# compiled with MSVC, which cannot be cross-compiled from macOS) and
# attaches it to the GitHub release for the pushed tag.
name: Release (Windows)

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

permissions:
  contents: write

jobs:
  windows:
    # windows-latest ships Visual Studio 2026 since 2026-06, which node-gyp
    # cannot detect yet (nodejs/node-gyp#3250) — pin to the VS2022 image.
    runs-on: windows-2022
    # Native rebuild + packaging normally takes <10 min — fail fast on hangs
    timeout-minutes: 25
    env:
      DEBUG: electron-builder
      npm_config_loglevel: info
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      # Lifecycle scripts are skipped: electron-builder's install-app-deps
      # (our postinstall) rebuilds node-pty through @electron/rebuild, which
      # swallows child output and has hung indefinitely on Windows runners.
      # The rebuild is done as an explicit, verbose, time-boxed step instead.
      - name: Install dependencies (skip lifecycle scripts)
        run: npm ci --ignore-scripts

      - name: Install esbuild platform binary
        run: npm rebuild esbuild

      - name: Build
        run: npm run build

      - name: Detect Electron version
        shell: pwsh
        run: |
          "ELECTRON_VERSION=$(node -p `"require('electron/package.json').version`")" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

      - name: Rebuild node-pty for Electron (verbose)
        working-directory: node_modules/node-pty
        timeout-minutes: 10
        shell: pwsh
        run: |
          npx node-gyp rebuild --target=$env:ELECTRON_VERSION --arch=x64 --dist-url=https://electronjs.org/headers --loglevel=verbose

      # npmRebuild=false: node-pty is already rebuilt for Electron above —
      # don't let electron-builder run its opaque rebuild again.
      - name: Package and publish Windows installer
        # quoted — pwsh otherwise splits the -c.npmRebuild token apart
        run: npx electron-builder --win "-c.npmRebuild=false" --publish always
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}