From b4d001eb267c7a7d0740aa5094ca929d846ab109 Mon Sep 17 00:00:00 2001 From: devsyncwrld Date: Tue, 1 Sep 2026 13:29:18 -0300 Subject: [PATCH] ci: add a fast Windows-only desktop build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release.yml builds four platforms and publishes a release, which is right for a release and slow for 'give me an exe to test'. Wall time is set by the Windows job, which compiles native modules and downloads Electron twice because it targets x64 and arm64 together — and Windows-on-ARM is not something this group runs. This path builds one architecture, caches the Electron and electron-builder downloads (~100MB re-fetched every run otherwise), and uploads the installer as an artifact, so it needs neither a tag nor a version bump. Kept as a separate file: release.yml comes from upstream and takes merges, so editing it would conflict on every update. Cost matters too on a private repository: macOS runners bill at 10x and Windows at 2x, so the full matrix was paying for macOS builds on every tag. --- .github/workflows/build-windows.yml | 81 +++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..e2a685ac --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,81 @@ +# Caminho rápido: só Windows x64, disparado à mão. +# +# O `release.yml` continua sendo o release de verdade (todas as plataformas, +# publica release e alimenta o electron-updater). Este aqui existe para quando +# você só quer um .exe para testar, sem marcar versão. +# +# Arquivo separado de propósito: o release.yml veio do upstream e recebe merges; +# mexer nele criaria conflito a cada atualização. +name: Build Windows (rápido) + +on: + workflow_dispatch: + inputs: + arch: + description: Arquitetura + required: false + default: x64 + type: choice + options: [x64, arm64] + +permissions: + contents: read + +jobs: + build: + # windows-2022, não windows-latest: a imagem latest traz o Visual Studio 18, + # que o node-gyp embutido no electron-rebuild não detecta ao compilar os + # módulos nativos. Mesma razão documentada no release.yml. + runs-on: windows-2022 + + steps: + - name: Checkout + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + + - name: Setup pnpm + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 + with: + version: 10.34.3 + + - name: Setup Node.js + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + with: + node-version: 20 + cache: pnpm + + # ~100MB de binários do Electron e das ferramentas do NSIS, baixados a + # cada execução sem isto. É o maior ganho depois de cortar o arm64. + - name: Cache Electron binaries + uses: actions/cache@v4 + with: + path: | + ~\AppData\Local\electron\Cache + ~\AppData\Local\electron-builder\Cache + key: electron-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: electron-cache-${{ runner.os }}- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build shared package + run: pnpm --filter @backspace/shared build + + - name: Compile desktop TypeScript + working-directory: packages/desktop + run: pnpm exec tsc + + # --publish never: sem release, sem precisar de tag nem bump de versão. + # O instalador sai como artefato desta execução. + - name: Build installer + working-directory: packages/desktop + run: pnpm exec electron-builder --win --${{ inputs.arch || 'x64' }} --publish never + env: + CSC_IDENTITY_AUTO_DISCOVERY: "false" + + - name: Upload installer + uses: actions/upload-artifact@v4 + with: + name: backspace-windows-${{ inputs.arch || 'x64' }} + path: packages/desktop/dist-electron/*.exe + retention-days: 14 + if-no-files-found: error