summaryrefslogtreecommitdiff
path: root/.github/workflows/release-windows.yml
blob: a45826568768dfc2aba9662e2f7f7c218d8a1543 (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
# 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:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4

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

      # The node-gyp version pulled in by the dependency tree (v9) cannot
      # detect Visual Studio 2022 on current runner images — point npm at
      # the latest node-gyp for the node-pty native rebuild.
      - name: Use latest node-gyp (VS2022 detection)
        shell: pwsh
        run: |
          npm install -g node-gyp@latest
          "npm_config_node_gyp=$(npm root -g)\node-gyp\bin\node-gyp.js" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

      - name: Install dependencies
        run: npm ci

      - name: Build
        run: npm run build

      - name: Package and publish Windows installer
        run: npx electron-builder --win --publish always
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}