# 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 Windows installer # quoted — pwsh otherwise splits the -c.npmRebuild token apart run: npx electron-builder --win "-c.npmRebuild=false" --publish never # Upload directly — electron-builder's GitHub publisher refuses to # attach assets to releases published more than 2 hours ago. - name: Upload installer to the release shell: pwsh run: | $version = node -p "require('./package.json').version" gh release upload "v$version" "dist/lattex-$version-win-x64.exe" --clobber env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}