windows-installer.yml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Windows Installer
  2. # Build the Windows installer .exe.
  3. #
  4. # Triggers:
  5. # - Tag push matching v* (release builds, uploaded as a release asset)
  6. # - Manual dispatch (for testing the build pipeline)
  7. #
  8. # The installer is unsigned until SignPath OSS approval lands. Once it
  9. # does, add the SignPath GitHub Action between the ISCC step and the
  10. # upload step.
  11. on:
  12. push:
  13. tags:
  14. - 'v*'
  15. workflow_dispatch:
  16. # Least-privilege per CodeQL actions/missing-workflow-permissions.
  17. # contents: write is required by softprops/action-gh-release to attach
  18. # the .exe to a tag release; the manual-dispatch path doesn't trigger
  19. # that step and could run with read-only, but a single workflow-level
  20. # block keeps the surface auditable in one place.
  21. permissions:
  22. contents: write
  23. jobs:
  24. build:
  25. runs-on: windows-latest
  26. timeout-minutes: 30
  27. steps:
  28. - name: Checkout
  29. uses: actions/checkout@v4
  30. - name: Setup Python
  31. uses: actions/setup-python@v5
  32. with:
  33. python-version: '3.13'
  34. - name: Setup Node.js
  35. uses: actions/setup-node@v4
  36. with:
  37. node-version: '22'
  38. # Inno Setup 6.x is pre-installed on windows-latest runners (under
  39. # C:\Program Files (x86)\Inno Setup 6\). No install step needed.
  40. - name: Stage installer artifacts
  41. working-directory: installers/windows
  42. run: python build.py
  43. shell: pwsh
  44. - name: Compile installer (ISCC)
  45. working-directory: installers/windows
  46. run: |
  47. & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" bambuddy.iss
  48. shell: pwsh
  49. # Stable + beta tag releases (e.g. v0.2.5b1, v0.3.0) get an unversioned
  50. # copy alongside the versioned filename so external surfaces (website,
  51. # wiki, newsletters) can link to a stable URL that survives version
  52. # bumps:
  53. #
  54. # https://github.com/maziggy/bambuddy/releases/latest/download/bambuddy-windows-x64-setup.exe
  55. #
  56. # GitHub's `latest` redirect excludes prereleases, so this URL always
  57. # points at whatever was released as a full release. Daily prereleases
  58. # are excluded from the alias because (a) the unversioned name would be
  59. # semantically confusing next to the date-stamped versioned name on a
  60. # daily prerelease page, and (b) there's no stable "latest daily" URL
  61. # anyway (`latest` skips prereleases), so the alias adds no value there.
  62. - name: Create unversioned alias (non-daily tags only)
  63. if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-daily.')
  64. shell: pwsh
  65. working-directory: installers/windows/build/output
  66. run: |
  67. $versioned = Get-ChildItem -Filter "bambuddy-*-windows-x64-setup.exe" | Select-Object -First 1
  68. if (-not $versioned) { throw "no versioned installer .exe found" }
  69. Copy-Item $versioned.FullName "bambuddy-windows-x64-setup.exe"
  70. Write-Host "alias: bambuddy-windows-x64-setup.exe -> $($versioned.Name)"
  71. - name: Upload installer artifact
  72. uses: actions/upload-artifact@v4
  73. with:
  74. name: bambuddy-windows-installer
  75. path: installers/windows/build/output/*.exe
  76. if-no-files-found: error
  77. - name: Attach installer to release
  78. if: startsWith(github.ref, 'refs/tags/v')
  79. uses: softprops/action-gh-release@v2
  80. with:
  81. files: installers/windows/build/output/*.exe
  82. fail_on_unmatched_files: true