ci: test pull requests and release main with semantic-release

Merged
M4
16d ago
+7061-2

Summary

  • Fix the build. main doesn't compile with Swift 6.2 (Xcode 26.3). WidgetPopup.swift mixes Double and CGFloat in min(...), and the compiler reports ambiguous use of operator '-' plus 7 follow-on errors. The popup inset and width are now converted to CGFloat explicitly.
  • CI (.github/workflows/ci.yml):
    • Test runs on macos-26 for every PR and every push to main: swift build --build-tests, then swift test.
    • Commit messages runs on PRs only. commitlint checks every commit and the PR title against Conventional Commits.
    • Release runs on main after the tests pass. semantic-release sets the version in Resources/Info.plist, updates CHANGELOG.md, commits both as chore(release): x.y.z [skip ci], tags vx.y.z and publishes the notes as a GitHub release. It only uses the workflow's GITHUB_TOKEN, so no secrets are needed.
  • scripts/set-version.sh sets CFBundleShortVersionString and CFBundleVersion without reformatting the plist, and fails without writing anything if a key is missing. It has Swift tests in ReleaseTests.swift.
  • README gets a "Releases" section that explains which commit types trigger which release.

Versioning

With no tags, semantic-release would make its first release 1.0.0. I pushed a v0.1.0 tag on a405ed4 (the current main) to match Info.plist, so versions continue from there.

Merge this PR with a merge commit or rebase so the fix: commit survives. That makes the first automated release 0.1.1, which runs the whole pipeline once. A squash merge would use the ci: title and release nothing until the next feat/fix.

DMG (not included)

The DMG is being built separately. Two config changes will hook it into releases:

  • In .releaserc.json, change prepareCmd to ./scripts/set-version.sh ${nextRelease.version} && ./scripts/package.sh.
  • Change "@semantic-release/github" to ["@semantic-release/github", { "assets": [{ "path": "dist/StableBar.dmg" }] }].

The release job already runs on macOS, so no workflow change is needed.

Testing

  • Clean build passes. With HOME pointed at an empty directory, all 20 tests pass. With my normal shell profile, scriptRecoversAfterACommandFailure fails (see Notes).
  • Full release rehearsal: a real (not dry-run) semantic-release run in a throwaway clone pushing to a local bare remote, with only the GitHub plugin disabled. Result: version 0.1.1, one chore(release) commit containing CHANGELOG.md and a two-line Info.plist change, and a v0.1.1 tag. The rehearsal caught that conventional-changelog-conventionalcommits@10 can't render with the latest release-notes generator (writer 8), so the preset is pinned to ^9.3.1.
  • actionlint, commitlint on these commits, and npm audit signatures all pass.

Notes

  • scriptRecoversAfterACommandFailure polls for at most ~2 s, but it needs two /bin/zsh -lc runs. When ~/.zprofile is slow (~1.3 s per login shell on my Mac), the second run doesn't finish in time. This predates this PR and is unchanged here. Raising the test's wait would fix it.
  • npm audit reports advisories in semantic-release's dependency tree. Most are in the npm CLI bundled with its npm plugin, which this config doesn't load. The rest are DoS-type issues in braces and micromatch, which have no patched release yet. These are CI-only dev dependencies that only process this repo's own commits and config.