generated from eblume/project-template
31 lines
1.2 KiB
Markdown
31 lines
1.2 KiB
Markdown
---
|
|
title: Release poll + version check
|
|
modified: 2026-06-04
|
|
tags:
|
|
- how-to
|
|
requires: []
|
|
---
|
|
|
|
# Release poll + version check
|
|
|
|
The piece that answers "is a newer release available?" — independent of any
|
|
daemon wiring, so it can be unit-tested in isolation.
|
|
|
|
## Deliverables
|
|
|
|
- Fetch the latest release from the forge:
|
|
`GET https://forge.ops.eblu.me/api/v1/repos/eblume/hephaestus/releases/latest`,
|
|
read `tag_name` (e.g. `v1.0.4`). hephd already depends on `ureq` and
|
|
`reqwest` (`crates/hephd/Cargo.toml`) — reuse one (the poll loop is async, so
|
|
`reqwest` fits; `ureq` would need `spawn_blocking`).
|
|
- Parse the running version: `heph_core::VERSION` is `"1.0.3 (sha)"` — take the
|
|
`X.Y.Z` head. Add `semver = "1"` to `crates/hephd/Cargo.toml` (already in the
|
|
lockfile transitively) and compare `tag_name` (strip leading `v`) against it.
|
|
- A pure `is_newer(current, tag) -> bool` helper with tests covering equal /
|
|
older / newer / malformed tags.
|
|
|
|
## Done when
|
|
|
|
Given a fixed current version and a sample releases-API JSON body, the helper
|
|
correctly reports whether an update exists. No daemon loop yet — that's
|
|
[[self-update-poll-loop]]. Part of [[hephd-self-update]].
|