Skip to content

feat(updater): auto-update via tauri-plugin-updater (based on #225) - #235

Merged
ErikBjare merged 6 commits into
ActivityWatch:masterfrom
TimeToBuildBob:pr-225
Jul 31, 2026
Merged

feat(updater): auto-update via tauri-plugin-updater (based on #225)#235
ErikBjare merged 6 commits into
ActivityWatch:masterfrom
TimeToBuildBob:pr-225

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Summary

This PR builds directly on the excellent implementation in #225 by @0xbrayo. It adds
the auto-update feature using tauri-plugin-updater with a proper fail-open CI gating
strategy, cleaned of testing artifacts.

Greenlit in #68 by @ErikBjare. The companion CI PR for the
activitywatch repo (which generates latest.json on tag releases) is
ActivityWatch/activitywatch#1372.

What #225 contributes (kept as-is)

  • tauri-plugin-updater integration and Rust implementation
  • updater_ui.rs — progress window with download bar and restart button
  • manager.rs — config error surface (show dialog instead of restart loop)
  • GitHub Actions: signing key secret wired into build.yml and release.yml

What this PR adds on top

  • Remove createUpdaterArtifacts from baseline configbuild.yml adds
    it dynamically only when TAURI_SIGNING_PRIVATE_KEY is set, so CI doesn't
    fail on unsigned builds (fail-open until Erik provisions the keypair)
  • Same conditional step added to release.yml — mirrors build.yml
    gating; includeUpdaterJson is also made conditional
  • Fix updater endpoint — was pointing at 0xbrayo/activitywatch fork;
    now ActivityWatch/activitywatch (matches what activitywatch#1372 publishes)
  • Clear test pubkey — placeholder "" until official key generated
  • Add .envrc to .gitignore — local signing key helper, shouldn't be committed

What's needed before updates work end-to-end

  1. Erik generates the signing keypair (after this PR merges):
    tauri signer generate -w ~/.tauri/aw-tauri.key
  2. Set org secret TAURI_SIGNING_PRIVATE_KEY (and optionally TAURI_SIGNING_PRIVATE_KEY_PASSWORD)
    in the ActivityWatch GitHub org settings
  3. Follow-up PR to update pubkey in src-tauri/tauri.conf.json with the
    generated public key — at that point CI can be switched to fail-closed

Test plan

  • CI builds succeed on a PR without signing secrets (fail-open)
  • Release builds with TAURI_SIGNING_PRIVATE_KEY set generate .sig files
  • latest.json is published by activitywatch#1372 on tag release
  • App detects and downloads update via the progress window from updater_ui.rs

0xbrayo and others added 5 commits July 31, 2026 13:54
Add an [updates] section to the user config (enabled by default). When
an update is found, automatically download, install, and restart when
enabled; otherwise fall back to the existing confirm dialog. Progress is
logged in 10% buckets and a desktop notification is shown while updating.

Also adds the updater:default capability required for handle.updater().
Add updater_ui.rs: a custom-protocol-served progress window (aw-update://)
so IPC works during download (data: URLs break Origin checks). Wire it
into the update-check flow in lib.rs with config-driven auto_download,
a restart_app/close_update_progress command pair, and an
AW_DISABLE_AUTO_UPDATE env var escape hatch mirroring gptme's pattern.

Add the update-progress capability window and scoped permissions file,
new assets/update-progress.html, and the tokio/log deps the progress
window and env-gating need.
- Remove createUpdaterArtifacts from baseline config; CI adds it
  dynamically only when TAURI_SIGNING_PRIVATE_KEY is set (fail-open
  until Erik provisions the signing keypair)
- Add conditional 'Configure updater artifacts' step to release.yml,
  matching build.yml; also make includeUpdaterJson conditional
- Clear test pubkey (empty string placeholder until official key generated)
- Fix updater endpoint from 0xbrayo fork to ActivityWatch/activitywatch
- Add .envrc to .gitignore (local signing key helper, not for repo)
@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds signed automatic updates and addresses the previously reported issues.

  • Conditionally enables updater artifacts and metadata when a signing key is configured, forwarding both the key and its password.
  • Adds the updater download, installation, progress-window, restart, and close flows.
  • Restricts updater-window commands to a dedicated capability.
  • Limits main-window close interception to the main window.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
.github/workflows/build.yml Conditionally enables signed updater artifacts and forwards both signing secrets to the build.
.github/workflows/release.yml Conditionally generates updater metadata and forwards the signing key password during release builds.
src-tauri/src/lib.rs Registers updater commands and correctly scopes close interception to the main window.
src-tauri/src/updater_ui.rs Implements creation, updates, and destruction of the dedicated updater progress window.
src-tauri/capabilities/default.json Removes updater-specific privileges from the main and module-alert windows.
src-tauri/capabilities/updater.json Grants the update-progress window only the restart and close commands it currently invokes.
src-tauri/assets/update-progress.html Provides the update progress, error, close, and restart interface.

Sequence Diagram

sequenceDiagram
  participant App as ActivityWatch
  participant Endpoint as Update endpoint
  participant Window as Update progress window
  participant User
  App->>Endpoint: Check for update
  Endpoint-->>App: Signed update metadata
  App->>Window: Show download progress
  App->>Endpoint: Download update
  Endpoint-->>App: Update artifact
  App->>App: Verify and install
  App->>Window: Enable restart
  User->>Window: Restart Now
  Window->>App: restart_app
Loading

Reviews (2): Last reviewed commit: "fix(updater): address review findings" | Re-trigger Greptile

Comment on lines 99 to 102
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
with:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Signing-key password is missing

When a password-protected updater key is configured, the workflow enables updater artifacts but forwards only TAURI_SIGNING_PRIVATE_KEY, causing both release and regular build jobs to fail while unlocking the key instead of producing signed updater artifacts.

Comment thread src-tauri/src/lib.rs
Comment on lines 1173 to 1178
@@ -913,7 +1177,12 @@ pub fn run() {
};
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Updater window cannot close

When the user dismisses the updater window, close_update_progress emits CloseRequested, but this unconditional handler prevents the close and hides the window instead, leaving the transient window allocated in Tauri's registry for the remainder of the process.

Suggested change
.on_window_event(|window, event| {
if window.label() == "main" {
if let tauri::WindowEvent::CloseRequested { api, .. } = &event {
api.prevent_close();
window.hide().expect("Failed to hide main window");
}
}
})

Comment on lines 5 to +19
"windows": [
"main",
"module-alert"
"module-alert",
"update-progress"
],
"permissions": [
"core:default",
"shell:allow-open",
"dialog:default",
"opener:default"
"opener:default",
"updater:default",
"allow-restart-app",
"allow-close-update-progress",
"allow-open-external",
"allow-greet"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Updater privileges are overly broad

This shared capability grants updater, restart, shell, dialog, and opener operations to the localhost dashboard and module-alert windows even though the update-progress window is the only UI that needs restart access, unnecessarily increasing the impact of script execution in the dashboard.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click.

This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted.

@ErikBjare
ErikBjare merged commit 9456328 into ActivityWatch:master Jul 31, 2026
3 checks passed
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.

3 participants