Repository navigation
release-0-9-8 #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release-0-9-8 #235
Changes from all commits
31b3afa
afa0626
dc37ef5
1b7b1c8
26f40b9
b3ceb76
f73565a
7ad3557
e92ac37
ac8817c
947cc8a
cdc38b4
7e04b06
46f5bb0
eb099c7
bad40c4
e392a05
36ec472
065bb0a
9c6fe08
0045bae
ef904de
87e4a06
67238a8
20eca74
df94679
8f556d3
f89b449
1963655
658778f
4d5f64f
ea819ba
37e31ea
55c42be
e6c9ea2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # herdr-t3 stable component | ||
|
|
||
| Managed install of [rebuildup/herdr-t3](https://github.com/rebuildup/herdr-t3) | ||
| as a native Electron desktop app for macOS and Windows 11 | ||
| (Issue #220, herdr-t3 ADR-0004, pc-setup ADR-0028). The earlier browser/PWA | ||
| bridge design is superseded and must not be revived. | ||
|
|
||
| ## Layout | ||
|
|
||
| ``` | ||
| $STATE_DIR/ # ~/.local/share/herdr-t3 or %LOCALAPPDATA%\herdr-t3 | ||
| releases/<ref>/ # one self-contained checkout+build per ref | ||
| current # text file naming the selected release | ||
| previous # release superseded by the last update | ||
| current_app # path to the staged .app / built .exe | ||
| installed # selected release name + commit | ||
| logs/ # build logs | ||
| ``` | ||
|
|
||
| Only `v*` tags or full commit SHAs are install targets; dev branches and | ||
| unreleased release candidates are never selected implicitly. Linux is out | ||
| of scope — the herdr TUI keeps its existing operation there. | ||
|
|
||
| ## Commands | ||
|
|
||
| | Action | macOS/POSIX | Windows 11 | | ||
| | --- | --- | --- | | ||
| | install | `install.sh [ref]` | `install.ps1 [-Ref <ref>]` | | ||
| | update | `update.sh [ref]` | `update.ps1 [-Ref <ref>]` | | ||
| | launch | `launch.sh` | `launch.ps1` | | ||
| | verify | `verify.sh [--live]` | `verify.ps1 [-Live]` | | ||
| | rollback | `rollback.sh` | `rollback.ps1` | | ||
|
|
||
| macOS stages the built `.app` into `~/Applications` so it behaves like a | ||
| normal app (Finder, Spotlight, Launch Services, Dock). Windows keeps the | ||
| built `win-unpacked` tree under the release dir and registers a Start Menu | ||
| shortcut (`%APPDATA%\Microsoft\Windows\Start Menu\Programs\herdr-t3.lnk`) | ||
| that tracks the selected executable. | ||
|
|
||
| `launch` is idempotent: it activates the already-running app. Builds happen | ||
| at install/update time only — never at launch. A failed install or update | ||
| leaves `current` (and the installed app / shortcut) untouched; `rollback` | ||
| flips the pointer back to the previous release dir, which is kept on disk, | ||
| and re-stages it. | ||
|
|
||
| `verify --live` additionally checks that the app process is running, the | ||
| herdr endpoint is reachable (macOS: `~/.config/herdr/herdr.sock`; Windows: | ||
| the named-pipe endpoint `\\.\pipe\<herdr.sock path>`), and — on macOS — | ||
| that the app's own `bridge-status.json` reports a fresh successful herdr | ||
| snapshot. | ||
|
|
||
| ## Integration notes | ||
|
|
||
| - Requires `git`, `mise` (herdr-t3 pins bun+node via `mise.toml`), `bun`, | ||
| `curl` (POSIX) / `Invoke-RestMethod` (Windows). | ||
| - Windows herdr connectivity goes through the named-pipe endpoint; the app | ||
| handles that transparently once herdr-t3#6 lands — until then | ||
| `verify.ps1 -Live` on Windows may report `herdr.reachable=false`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # herdr-t3 stable install — native Electron app (Windows 11). | ||
| # | ||
| # Installs a verified release of rebuildup/herdr-t3 into the managed state | ||
| # dir as an independent per-ref checkout, builds the app once with | ||
| # electron-builder (win-unpacked + NSIS installer), and only then selects | ||
| # it. A failed install or update never disturbs the selected release. | ||
| # | ||
| # Usage: install.ps1 [-Ref <ref>] | ||
| param([string]$Ref = "") | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
| $RepoUrl = "https://github.com/rebuildup/herdr-t3.git" | ||
| $StateDir = if ($env:HERDR_T3_STATE_DIR) { $env:HERDR_T3_STATE_DIR } else { Join-Path $env:LOCALAPPDATA "herdr-t3" } | ||
| $ReleasesDir = Join-Path $StateDir "releases" | ||
| $CurrentFile = Join-Path $StateDir "current" | ||
| $AppFile = Join-Path $StateDir "current_app" | ||
| $LogDir = Join-Path $StateDir "logs" | ||
| New-Item -ItemType Directory -Force -Path $ReleasesDir, $LogDir | Out-Null | ||
|
|
||
| function Log($msg) { Write-Host "[herdr-t3] $msg" } | ||
| function Die($msg) { Write-Host "[herdr-t3] ERROR: $msg" -ForegroundColor Red; exit 1 } | ||
|
|
||
| if (-not $Ref) { | ||
| # Stable release tags only: a prerelease tag like v1.1.0-rc.1 would fail | ||
| # the [version] cast below and must never win auto-selection. | ||
| $tags = git ls-remote --tags $RepoUrl "refs/tags/v*" | | ||
| ForEach-Object { ($_ -split "/")[-1] } | Where-Object { $_ -match '^v\d+\.\d+\.\d+$' } | ||
| $Ref = $tags | Sort-Object { [version]($_.TrimStart('v')) } | Select-Object -Last 1 | ||
| if (-not $Ref) { Die "no stable v* tag found on $RepoUrl" } | ||
| } | ||
| if ($Ref -match '^v[0-9]') { | ||
| git ls-remote --exit-code --tags $RepoUrl "refs/tags/$Ref" | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "tag $Ref not found on $RepoUrl" } | ||
| } elseif ($Ref -notmatch '^[0-9a-f]{40}$') { | ||
| Die "ref must be a v* tag or a full 40-char SHA (got: $Ref)" | ||
| } | ||
|
|
||
| $name = $Ref -replace '[/\\:]', '_' | ||
| $target = Join-Path $ReleasesDir $name | ||
|
|
||
| if (-not (Test-Path (Join-Path $target ".git"))) { | ||
| Log "cloning $Ref into $target" | ||
| git clone --quiet $RepoUrl $target | ||
| } else { | ||
| git -C $target fetch --quiet --tags origin | ||
| } | ||
| git -C $target checkout --quiet $Ref | ||
| if ($LASTEXITCODE -ne 0) { Die "git checkout $Ref failed in $target" } | ||
| $commit = (git -C $target rev-parse HEAD).Trim() | ||
|
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checkout の成功を確認してからビルドしてください。 存在しない40桁 SHA を指定すると、clone 成功後の 通常の PowerShell 設定では、 clone、fetch、checkout、rev-parse の直後で
|
||
| Log "building $name ($commit)" | ||
|
|
||
| Push-Location $target | ||
| try { | ||
| mise install --locked | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "mise install failed" } | ||
| bun install --frozen-lockfile | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "bun install failed" } | ||
| $env:CSC_IDENTITY_AUTO_DISCOVERY = "false" | ||
| bun run desktop:pack | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "electron-builder failed" } | ||
| } finally { Pop-Location } | ||
|
|
||
| $exe = Join-Path $target "release\win-unpacked\herdr-t3.exe" | ||
| if (-not (Test-Path $exe)) { Die "built app missing: $exe" } | ||
|
|
||
| . (Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) "shortcut.ps1") | ||
|
|
||
| $prevCurrent = if (Test-Path $CurrentFile) { (Get-Content $CurrentFile -Raw).Trim() } else { $null } | ||
| $prevApp = if (Test-Path $AppFile) { (Get-Content $AppFile -Raw).Trim() } else { $null } | ||
| $prevShortcut = Get-HerdrT3ShortcutTarget | ||
|
|
||
| try { | ||
| Set-Content $CurrentFile $name | ||
| Set-Content $AppFile $exe | ||
| Set-HerdrT3Shortcut -ExePath $exe | ||
| } catch { | ||
| if ($null -ne $prevCurrent) { Set-Content $CurrentFile $prevCurrent } else { Remove-Item $CurrentFile -Force -ErrorAction SilentlyContinue } | ||
| if ($null -ne $prevApp) { Set-Content $AppFile $prevApp } else { Remove-Item $AppFile -Force -ErrorAction SilentlyContinue } | ||
| if ($prevShortcut) { try { Set-HerdrT3Shortcut -ExePath $prevShortcut } catch { } } | ||
| Die "shortcut registration failed; previous selection restored" | ||
| } | ||
| Log "installed $name ($commit); current -> $name ($exe)" | ||
Uh oh!
There was an error while loading. Please reload this page.