Skip to content

Add macOS distributable support with .icns icon generation#21

Open
rogerb831 wants to merge 13 commits intolukasbach:mainfrom
rogerb831:fix/mac-distributable
Open

Add macOS distributable support with .icns icon generation#21
rogerb831 wants to merge 13 commits intolukasbach:mainfrom
rogerb831:fix/mac-distributable

Conversation

@rogerb831
Copy link
Contributor

Summary

This PR adds support for building and publishing macOS distributables (both ARM64 and x64) in the CI/CD pipeline, along with proper macOS icon generation.

Changes

CI/CD Pipeline Updates

  • Added macOS builds to verify workflow: Matrix strategy for both ARM64 and x64 architectures
  • Added macOS builds to publish workflow: Includes both ARM64 and x64 distributables
  • Fixed x64 builds: Uses macos-15-intel runner for Intel-based builds
  • Version bump logic: Only bumps version for upstream repository (lukasbach/pensieve), allowing forks to publish without version conflicts
  • Dynamic repository detection: GitHub publisher uses environment variables to detect fork vs upstream

macOS Icon Generation

  • Added .icns icon generation: Uses macOS iconutil to create proper macOS icon format
  • Generates all required sizes: Creates icons from 16x16 through 1024x1024 with @2x variants
  • Platform-specific asset generation: Generates .icns for macOS, .ico for Windows
  • Updated DMG maker: Uses .icns format for macOS DMG files

Bug Fixes

  • Fixed ASAR packaging errors: Removed problematic symlinks in node_modules/.bin directories that break ASAR packaging
  • Fixed console statements: Replaced console.log/console.error with proper logging
  • Fixed TypeScript errors: Resolved type issues in vector-search.ts and recording-chat.tsx

Testing

  • ✅ Tested locally: macOS ARM64 build succeeds
  • ✅ Icon generation: Both .icns and .ico files generated correctly
  • ✅ Typecheck: All TypeScript checks pass
  • ✅ Linting: All Prettier formatting issues resolved

Related Issues

Addresses macOS build support for the project.

- Add macOS to verify.yml workflow matrix to test builds on both Windows and macOS
- Enable macOS in publish.yml workflow matrix to publish macOS distributables
- Both workflows now run on windows-latest and macos-latest

This enables building and testing macOS DMG and ZIP distributables in CI.
- Add packageAfterPrune hook to remove problematic .bin symlinks that break ASAR packaging
- Recursively remove all .bin directories and symlinks from node_modules
- Add architecture matrix to workflows for building both arm64 and x64 macOS distributables
- Windows builds unchanged (no architecture specified)
- macOS builds now test both arm64 and x64 architectures

The symlink removal is safe as .bin directories are only needed for development
(npm/yarn scripts), not at runtime.
- Change x64 macOS builds to use macos-15-intel runner (Intel hardware)
  - macos-latest runners are ARM64 and cannot natively build x64
- Update forge.config.ts to read repository owner and name from environment variables
  - Owner: Uses GITHUB_REPOSITORY_OWNER or parses GITHUB_REPOSITORY
  - Name: Parses GITHUB_REPOSITORY to extract repo name
  - Falls back to hardcoded 'lukasbach/pensieve' if env vars not set
- Update publish.yml workflow to pass repository info as environment variables
  - Sets GITHUB_REPOSITORY_OWNER from github.repository_owner
  - Sets GITHUB_REPOSITORY from github.repository
  - Allows publishing releases to any fork that runs the workflow
- Move version bump to dedicated 'bump-version' job that runs first
- Add 'needs: bump-version' to publish job so it waits for version bump
- Prevents conflicts when multiple matrix jobs try to bump version simultaneously
- Each publish job will checkout the code with the updated version already committed
- Split workflow into three jobs: build, bump-version, publish
- Build job runs all platforms in parallel, uploads distributables as artifacts
- Bump-version job only runs if all builds succeed (needs: build)
- Publish job downloads pre-built distributables and publishes them
- Version is only incremented if builds succeed, preventing version bumps on failures
- Uses artifact_suffix in matrix for consistent artifact naming
- Add condition to bump-version job: only runs if github.repository == 'lukasbach/pensieve'
- Update publish job to depend on both build and bump-version
- Publish job runs if bump-version succeeded or was skipped (for forks)
- Allows forks to publish releases without version bumps
- Version bumps should only happen in upstream CI
- Remove build-first approach that separated build and publish jobs
- Keep fork-friendly logic from bca725a (skip version bump for non-upstream)
- Restore simpler workflow: bump-version -> publish (builds and publishes)
- Version bump happens before builds, ensuring correct version in distributables
- Generate .icns file for macOS using iconutil
- Create all required macOS icon sizes (16x16 through 1024x1024 with @2x variants)
- Update packagerConfig to use base icon path for automatic platform detection
- Update MakerDMG to use .icns format
- Rename Windows ICO from [email protected] to icon.ico for standard naming
- Generate both .ico and .icns formats for cross-platform compatibility
- Add postMake hook to automatically embed Pensieve Installer.app into DMG
- Installer helper automatically copies app to Applications and removes quarantine
- Fix icon configuration to use platform-appropriate format (.icns for macOS)
- Update README with instructions for using the DMG installer helper
- Use array destructuring for regex match result
- Convert lonely if in else block to else if
- Fix Prettier formatting issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant