name: Release # Builds the Windows installer and publishes it to a GitHub Release. Runs on # a version tag push (e.g. `v0.1.0`) so a normal "bump version, tag, push" # flow gets a downloadable installer automatically; workflow_dispatch is # there too so a run can be retried/tested without cutting a new tag. on: push: tags: - "v*.*.*" workflow_dispatch: permissions: contents: write jobs: build-and-release: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v7 - name: Set up Node uses: actions/setup-node@v7 with: # Electron 43's npm package requires Node >= 22.12.0 (it declares it # in engines, and its installer uses @electron/get which does too). # Node 20 here would fail the build on install. node-version: 22 - name: Install dependencies run: npm ci - name: Build and publish installer run: npx electron-builder --win --x64 --publish always env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # electron-builder's own draft->published finalize step has been flaky # in testing (assets uploaded and the release correctly tagged, but left # sitting as a draft) — explicitly finishing it here via `gh` is a more # reliable belt-and-suspenders step. Also sets the release body from # CHANGELOG.md's section for this version, which is both the human- # readable release notes on GitHub *and* what electron-updater reads as # releaseNotes for the in-app "Check for Updates" screen. Only runs for # an actual tag push, since workflow_dispatch on a branch has no tag # (and no changelog section) to publish. - name: Finalize the release (notes + un-draft) if: startsWith(github.ref, 'refs/tags/') run: | node scripts/extract-changelog.cjs "${{ github.ref_name }}" release-notes.md gh release edit "${{ github.ref_name }}" --notes-file release-notes.md --draft=false env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}