Skip to content

feat: add in-app auto-update via Wails v3 updater and installer packaging#72

Merged
amemya merged 3 commits into
mainfrom
feat/installer-and-auto-update
Jun 20, 2026
Merged

feat: add in-app auto-update via Wails v3 updater and installer packaging#72
amemya merged 3 commits into
mainfrom
feat/installer-and-auto-update

Conversation

@amemya

@amemya amemya commented Jun 19, 2026

Copy link
Copy Markdown
Owner

wails v3のオートアップデート機能とインストーラによるインストールを実装

resolved #61

amemya added 2 commits June 20, 2026 01:10
…ging

- Add updater.go with Wails v3 app.Updater integration (GitHub provider)
  - CheckForUpdate(), TriggerUpdate(), RestartApp() exposed to frontend
  - 4-hour periodic background update checks
  - Graceful error handling (check failures logged, not shown to user)
- Replace old CheckForUpdates() in app.go with new updater flow
- Update App.tsx with 5-stage update UI:
  available → downloading (progress bar) → verifying → ready → restart
- Add CSS for progress bar, green restart button with pulse animation
- Update release.yml CI/CD:
  - macOS: DMG installer via create-dmg + bare binary for auto-update
  - Windows: NSIS installer generation
  - SHA256SUMS checksum file for download verification
- Add golang.org/x/mod dependency (used by Wails updater semver)
- Add prefers-reduced-motion to update button animation
- Fix update progress bar border-radius
- Add CheckForUpdate and App trigger timeouts
- Improve updater.go initialization error logging
- Fix UpdateStatus typing and checking state in App.tsx
- Update Windows NSIS configuration to user context for updates
- Refine artifact generation, verification, and artifact upload paths
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ea88e7ff-17ee-4d1b-a214-23c215707435

📥 Commits

Reviewing files that changed from the base of the PR and between 84706ab and e8a6f66.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • frontend/src/App.tsx

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • イベント駆動のアップデータで、ダウンロード進捗・検証・再起動・失敗状態を段階表示
    • macOS 向け DMG 配布を追加
  • Improvements
    • Windows インストーラの更新先をユーザー単位に変更し、更新の手間を軽減
    • エラー/再起動ボタンの見た目と挙動を改善
  • Build & Release
    • リリース工程と成果物の扱いを整理(バージョン埋め込み、OS別の配布物をまとめて公開、整合性情報を生成)

ウォークスルー

app.go の旧 GitHub Releases ベースのアップデータを削除し、新規 updater.go で Wails v3 内蔵アップデータを初期化する構成に置き換えた。フロントエンドはイベント駆動のステートマシンへ刷新。CI リリースワークフローには ldflags バージョン埋め込み、macOS DMG 生成、SHA256SUMS 生成、Windows インストーラのユーザースコープ変更を追加した。

変更内容

Wails v3 アップデータへの置き換え

Layer / File(s) Summary
Version を var 化・旧アップデータ削除
version.go, app.go
Versionconst から var(ldflags 上書き用)に変更し、app.go から UpdateInfo 型・CheckForUpdates メソッド・encoding/json import を削除。
updater.go:InitUpdater と公開メソッド
updater.go, main.go, go.mod
InitUpdater が GitHub プロバイダで Wails updater を初期化。UpdateStatus 構造体と CheckForUpdateTriggerUpdateRestartAppApp の公開メソッドとして実装。main.goInitUpdater を呼び出して起動時に初期化。
フロントエンド:イベント駆動 UI
frontend/src/App.tsx, frontend/src/App.css
型定義を UpdateInfo から UpdateStage/UpdateState/UpdateStatus に置き換え。wails:updater:* イベントを購読してステージを遷移。ヘッダーの更新 UI をステージ別ボタン/進捗バー/再起動表示に全面変更。CSS に進捗・再起動・エラー用スタイルを追加。

CI リリースワークフロー改善

Layer / File(s) Summary
ldflags 埋め込み・DMG 生成・アーティファクト収集・SHA256SUMS
.github/workflows/release.yml
Linux/Windows の go build-ldflagsVersion を埋め込む。権限設定を細粒度化し build ジョブで contents: read を付与。macOS に create-dmg による DMG 生成とオートアップデート用バイナリコピーを追加。Windows の NSIS で ${VERSION} 置換を明示。アップロード設定をグロブ収集(build-OS 命名、未検出時 warn)に変更。リリースジョブで SHA256SUMS を生成し添付。
Windows NSIS インストーラのユーザースコープ変更
build/windows/installer/project.nsi
RequestExecutionLeveluser に設定し、InstallDirLOCALAPPDATA\Programs 配下に変更して UAC なしの自動更新を可能にする。

シーケンス図

sequenceDiagram
  participant User
  participant Frontend
  participant App
  participant WailsUpdater
  participant GitHub

  User->>Frontend: アプリ起動
  Frontend->>App: CheckForUpdate()
  App->>WailsUpdater: Check(ctx, 10s)
  WailsUpdater->>GitHub: 最新リリース取得
  GitHub-->>WailsUpdater: リリース情報
  WailsUpdater-->>App: 結果
  App-->>Frontend: UpdateStatus{state: available}

  User->>Frontend: 更新ボタンをクリック
  Frontend->>App: TriggerUpdate()
  App->>WailsUpdater: DownloadAndInstall(ctx, 5min)
  WailsUpdater-->>Frontend: wails:updater:verifying
  WailsUpdater-->>Frontend: wails:updater:installing
  WailsUpdater-->>Frontend: wails:updater:ready
  App-->>Frontend: UpdateStatus{state: ready}

  User->>Frontend: 再起動ボタンをクリック
  Frontend->>App: RestartApp()
  App->>WailsUpdater: Restart(ctx, 10s)
  WailsUpdater-->>App: done
  App-->>Frontend: UpdateStatus{state: restarting}
Loading

推定レビュー工数

🎯 4 (Complex) | ⏱️ ~60 minutes

関連する可能性のある PR

  • amemya/ExifFrame#10: .github/workflows/release.yml の新規作成と基本的なビルドステップを導入した PR で、本 PR はそのワークフローに DMG 生成・ldflags バージョン埋め込み・SHA256SUMS 生成などの本格的なリリース機能を追加している。
  • amemya/ExifFrame#59: app.goUpdateInfo/CheckForUpdates を追加し、frontend/src/App.tsx に GitHub Releases 問い合わせベースの更新 UI を実装した PR で、本 PR ではその実装全体を削除して Wails v3 内蔵アップデータベースの実装に完全に置き換えている。
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PRのタイトルは、Wails v3を使用したインアプリ自動更新機能とインストーラーパッケージングの追加という、変更セットの主要な目的を明確に要約しており、関連性が高い。
Description check ✅ Passed PR説明は、Wails v3の自動更新機能とインストーラーベースのインストールの実装について言及しており、変更セット全体に関連している。
Linked Issues check ✅ Passed PR#61の目標である「配布形式をバイナリではなくインストーラにする」に対して、リリースワークフローでのインストーラー生成(DMG、NSIS)、Windows/macOSのインストーラー設定変更、およびWails v3の自動更新機能実装により、完全に対応している。
Out of Scope Changes check ✅ Passed 変更内容はすべてインストーラー実装と自動更新機能に関連しており、PR#61の要件を直接サポートしている。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/installer-and-auto-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

9-19: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

ワークフローレベルで明示的な permissions ブロックの追加を推奨

build ジョブには明示的な permissions ブロックがありません。最小権限の原則に従い、ワークフローレベルで permissions: {} を設定し、必要なジョブのみで権限を明示的に付与することで、セキュリティ体制が強化されます。

🔒 ワークフローレベルの permissions 追加例
 on:
   release:
     types: [published]

+permissions: {}
+
 jobs:
   build:
+    permissions:
+      contents: read
     strategy:
       matrix:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 9 - 19, The workflow file is
missing an explicit permissions block at the workflow level, which violates the
principle of least privilege. Add a `permissions: {}` block at the workflow
level (before the `build` job definition) to remove all default permissions, and
then explicitly grant only the necessary permissions to individual jobs like
`build` that actually require them, such as `contents: write` if the job needs
to write artifacts or create releases.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 236-241: The SHA256SUMS generation in the Generate SHA256SUMS step
is outputting file paths with `./` prefixes (e.g., `./ExifFrame-darwin-arm64`),
which will cause checksum verification failures when the Wails updater compares
filenames. Modify the find command that generates SHA256SUMS to strip the `./`
prefix from the output paths. This can be accomplished by piping the sha256sum
output through sed to remove the leading `./` characters, ensuring that the file
paths in SHA256SUMS match the actual artifact filenames without directory
prefixes.

In `@frontend/src/App.tsx`:
- Around line 358-360: The catch block for the update check promise is resetting
the stage to 'idle' which suppresses the error from appearing in the UI. Modify
the catch handler to instead set stage to 'error' and provide an appropriate
errorMessage value (similar to how the status.state === 'error' branch handles
errors). This ensures that when the RPC call fails, the error state is properly
communicated to the user instead of being hidden.
- Around line 770-776: The TriggerUpdate() and RestartApp() methods return an
UpdateStatus object with a state property indicating success or error, rather
than rejecting the Promise on failure. Currently, the code only handles Promise
rejection in the catch block, but when the backend returns an error state, the
Promise resolves successfully and the UI remains stuck in the downloading or
restarting state. Add proper handling after the TriggerUpdate() call (and
similarly for RestartApp() around line 806) to check the returned UpdateStatus
object's state property and update the UI state to display the error message
when state equals "error", rather than relying solely on the catch block for
error handling.

---

Outside diff comments:
In @.github/workflows/release.yml:
- Around line 9-19: The workflow file is missing an explicit permissions block
at the workflow level, which violates the principle of least privilege. Add a
`permissions: {}` block at the workflow level (before the `build` job
definition) to remove all default permissions, and then explicitly grant only
the necessary permissions to individual jobs like `build` that actually require
them, such as `contents: write` if the job needs to write artifacts or create
releases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ad9b90c6-f577-42ac-a08e-d906125d8271

📥 Commits

Reviewing files that changed from the base of the PR and between adf27e9 and 84706ab.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (9)
  • .github/workflows/release.yml
  • app.go
  • build/windows/installer/project.nsi
  • frontend/src/App.css
  • frontend/src/App.tsx
  • go.mod
  • main.go
  • updater.go
  • version.go
💤 Files with no reviewable changes (1)
  • app.go

Comment thread .github/workflows/release.yml
Comment thread frontend/src/App.tsx Outdated
Comment thread frontend/src/App.tsx
- Fix SHA256SUMS prefix issue with sed
- Improve App.tsx update error handling in catch block and Promise resolutions
- Apply workflow-level permissions minimizing permissions for build job
@amemya amemya merged commit 9355c63 into main Jun 20, 2026
1 check passed
@amemya amemya deleted the feat/installer-and-auto-update branch June 20, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

配布形式をバイナリではなくインストーラにする

1 participant