Skip to content

Commit 133237a

Browse files
committed
Initial commit: minimal Wails v3 self-update demo
Release target for v3/examples/updater. Each tagged release ships darwin/arm64, linux/amd64, and windows/amd64 binaries plus a SHA256SUMS sidecar so the framework's updater example can demo the full check → download → verify → swap → restart flow against a real GitHub release. Pinned to the v3-alpha-feature/updater branch tip via pseudo-version v3.0.0-alpha.91.0.20260515212724-2f47e04dbfff. Bump to a published alpha once the updater PR merges.
0 parents  commit 133237a

9 files changed

Lines changed: 601 additions & 0 deletions

File tree

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/bin/
2+
/build/
3+
/dist/
4+
*.app/
5+
*.exe
6+
*.zip
7+
*.tar.gz
8+
SHA256SUMS
9+
.DS_Store
10+
node_modules/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Wails
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# updater-demo
2+
3+
Release target for the Wails v3 updater example
4+
([`v3/examples/updater`](https://github.com/wailsapp/wails/tree/master/v3/examples/updater)).
5+
Each tagged release of this repository ships pre-built binaries for
6+
darwin/arm64, linux/amd64, and windows/amd64 plus a `SHA256SUMS`
7+
sidecar, so the example can demonstrate the full update flow
8+
end-to-end against a real GitHub release.
9+
10+
> This repo is **not** a starter template. For that, run `wails3 init`.
11+
> This is the artifact source the framework's updater example downloads
12+
> from when you click **App → Check for Updates…**
13+
14+
## What the binary does
15+
16+
It opens a single window that prints its own version in big letters
17+
and mirrors `updater:*` events into a status panel. The version is
18+
baked in at build time via `-ldflags="-X main.version=<v>"`, so
19+
v1.0.0 and v2.0.0 are visually distinguishable.
20+
21+
## Cutting a release
22+
23+
Releases are built natively on three machines and combined manually
24+
— there's no CI here on purpose (the demo is small, the manual flow
25+
is transparent).
26+
27+
1. **On each platform**, clone the repo and run:
28+
29+
```sh
30+
VERSION=2.0.0 scripts/build.sh
31+
```
32+
33+
produces `dist/updater-demo_<goos>_<goarch>.<ext>`.
34+
35+
2. **Collect** all archives into a single host's `dist/` directory
36+
via `scp` and run:
37+
38+
```sh
39+
scripts/release.sh 2.0.0
40+
```
41+
42+
which computes `SHA256SUMS` and `gh release create`s the tag with
43+
every archive attached.
44+
45+
## Platform notes
46+
47+
- **darwin**: plain `tar.gz` of the binary, not a `.app` bundle. The
48+
updater's helper does a direct `exec.Command(target)` on swap, so
49+
the runtime form matches whatever the calling app is — keeping
50+
this a plain binary avoids `.app`-vs-binary swap-type mismatches.
51+
- **linux**: depends on `libgtk-3` and `libwebkit2gtk-4.1` at runtime.
52+
- **windows**: built with `-H windowsgui` so the binary has no
53+
console window when launched. Requires WebView2 Runtime on the
54+
user's machine (preinstalled on Win10 1903+).
55+
56+
## License
57+
58+
MIT — see [LICENSE](./LICENSE).

assets/index.html

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<title>Updater Demo</title>
7+
<style>
8+
:root { color-scheme: light dark; }
9+
body {
10+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
11+
padding: 24px;
12+
margin: 0;
13+
display: flex;
14+
flex-direction: column;
15+
align-items: center;
16+
justify-content: center;
17+
min-height: 100vh;
18+
box-sizing: border-box;
19+
color: #1d1d1f;
20+
background: #ffffff;
21+
}
22+
@media (prefers-color-scheme: dark) {
23+
body { background: #1e1e1e; color: #f5f5f7; }
24+
}
25+
.badge {
26+
font-size: 14px;
27+
letter-spacing: 0.08em;
28+
text-transform: uppercase;
29+
color: #6e6e73;
30+
margin-bottom: 8px;
31+
}
32+
.version {
33+
font-size: clamp(64px, 18vw, 144px);
34+
font-weight: 700;
35+
letter-spacing: -0.04em;
36+
line-height: 1;
37+
margin: 0 0 24px;
38+
font-variant-numeric: tabular-nums;
39+
}
40+
.hint {
41+
font-size: 14px;
42+
color: #6e6e73;
43+
max-width: 480px;
44+
text-align: center;
45+
margin: 0 0 24px;
46+
}
47+
.status {
48+
width: min(560px, 100%);
49+
padding: 12px 14px;
50+
background: rgba(0,0,0,0.06);
51+
border-radius: 8px;
52+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
53+
font-size: 12px;
54+
white-space: pre-wrap;
55+
max-height: 12em;
56+
overflow-y: auto;
57+
}
58+
@media (prefers-color-scheme: dark) {
59+
.status { background: rgba(255,255,255,0.06); }
60+
}
61+
</style>
62+
</head>
63+
<body>
64+
<div class="badge">running version</div>
65+
<p class="version" id="version"></p>
66+
<p class="hint">Use <strong>App → Check for Updates…</strong> to swap this
67+
binary for the latest release on
68+
<code>wailsapp/updater-demo</code> and restart.</p>
69+
<div class="status" id="status">waiting…</div>
70+
71+
<script type="module">
72+
const params = new URLSearchParams(location.search);
73+
document.getElementById("version").textContent = "v" + (params.get("v") || "?");
74+
75+
const status = document.getElementById("status");
76+
function log(line) {
77+
const t = new Date().toISOString().slice(11, 19);
78+
status.textContent = `[${t}] ${line}\n` + status.textContent;
79+
}
80+
const wails = window.wails;
81+
if (wails && wails.Events) {
82+
wails.Events.On("updater:check-started", () => log("check started"));
83+
wails.Events.On("updater:update-available", (e) => log(`available: v${(e.data ?? e).version}`));
84+
wails.Events.On("updater:no-update", () => log("up to date"));
85+
wails.Events.On("updater:download-progress", (e) => {
86+
const p = e.data ?? e;
87+
if (p.total > 0) log(`downloading: ${p.written}/${p.total}`);
88+
else log(`downloading: ${p.written} bytes`);
89+
});
90+
wails.Events.On("updater:update-ready", () => log("ready — restart to apply"));
91+
wails.Events.On("updater:error", (e) => log(`error: ${(e.data ?? e).message}`));
92+
}
93+
</script>
94+
</body>
95+
</html>

go.mod

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module github.com/wailsapp/updater-demo
2+
3+
go 1.26.2
4+
5+
require github.com/wailsapp/wails/v3 v3.0.0-alpha.91.0.20260515212724-2f47e04dbfff
6+
7+
require (
8+
dario.cat/mergo v1.0.2 // indirect
9+
github.com/Microsoft/go-winio v0.6.2 // indirect
10+
github.com/ProtonMail/go-crypto v1.3.0 // indirect
11+
github.com/adrg/xdg v0.5.3 // indirect
12+
github.com/bep/debounce v1.2.1 // indirect
13+
github.com/cloudflare/circl v1.6.3 // indirect
14+
github.com/coder/websocket v1.8.14 // indirect
15+
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
16+
github.com/ebitengine/purego v0.9.1 // indirect
17+
github.com/emirpasic/gods v1.18.1 // indirect
18+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
19+
github.com/go-git/go-billy/v5 v5.9.0 // indirect
20+
github.com/go-git/go-git/v5 v5.19.0 // indirect
21+
github.com/go-ole/go-ole v1.3.0 // indirect
22+
github.com/godbus/dbus/v5 v5.2.2 // indirect
23+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
24+
github.com/google/uuid v1.6.0 // indirect
25+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
26+
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 // indirect
27+
github.com/kevinburke/ssh_config v1.4.0 // indirect
28+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
29+
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
30+
github.com/leaanthony/u v1.1.1 // indirect
31+
github.com/lmittmann/tint v1.1.2 // indirect
32+
github.com/mattn/go-colorable v0.1.14 // indirect
33+
github.com/mattn/go-isatty v0.0.20 // indirect
34+
github.com/pjbgf/sha1cd v0.6.0 // indirect
35+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
36+
github.com/rivo/uniseg v0.4.7 // indirect
37+
github.com/samber/lo v1.52.0 // indirect
38+
github.com/sergi/go-diff v1.4.0 // indirect
39+
github.com/skeema/knownhosts v1.3.2 // indirect
40+
github.com/wailsapp/wails/webview2 v1.0.24 // indirect
41+
github.com/xanzy/ssh-agent v0.3.3 // indirect
42+
golang.org/x/crypto v0.50.0 // indirect
43+
golang.org/x/mod v0.35.0 // indirect
44+
golang.org/x/net v0.53.0 // indirect
45+
golang.org/x/sys v0.43.0 // indirect
46+
golang.org/x/text v0.37.0 // indirect
47+
gopkg.in/warnings.v0 v0.1.2 // indirect
48+
)

0 commit comments

Comments
 (0)