Publish desktop releases to a self-hosted dnf repo

scripts/rpm-publish.sh builds the RPM, signs it and the repo metadata
with a dedicated GPG key, and adds it to a dnf repo in a given directory,
keeping the newest three versions for downgrades. The directory holds
nothing secret, so it can be served as is.

Both publish scripts now share the version scheme in
scripts/lib/release-version.sh: <major>.<minor>.<commit count>, plain
enough for RPM, MSI and semver alike. Android's versionCode stays the
commit count.

Fixes the publish scripts failing under set -u when the repo URL
variable isn't set, which is every run after the first. tauri.conf.json
now declares the license and homepage for the package metadata.
This commit is contained in:
2026-10-13 22:05:17 -05:00
parent 348a950489
commit 8d510b8ffd
6 changed files with 279 additions and 8 deletions

View File

@@ -91,6 +91,53 @@ Notes:
- The `[profile.release]` settings in `Cargo.toml` (strip + LTO) make the release
build take a few minutes but keep the binary small.
### Distributing to Fedora (dnf repo)
Fedora machines get the app, and its updates, from a small dnf repo you host
yourself. `scripts/rpm-publish.sh` builds a signed RPM and adds it to the repo
in a directory you choose. It needs:
```bash
sudo dnf install rpm-sign createrepo_c
```
The first run also makes the package signing key. Give it the address the
directory will be served at:
```bash
RPM_REPO_URL=https://rpm.example.com/mtgc ./scripts/rpm-publish.sh --init-key ~/rpm-mtgc
```
After that, publishing is just:
```bash
./scripts/rpm-publish.sh ~/rpm-mtgc # or: npm run rpm:publish -- ~/rpm-mtgc
```
Then, on each machine, add the repo once and install:
```bash
sudo dnf config-manager addrepo --from-repofile=https://rpm.example.com/mtgc/mtgc.repo
```
```bash
sudo dnf install mtgc
```
From then on, `sudo dnf upgrade` picks up new releases.
- **Serve the whole directory.** Unlike the F-Droid repo, nothing in it is
secret. It holds the RPMs, the signed `repodata/`, the public key
(`RPM-GPG-KEY-mtgc`) and `mtgc.repo`. The newest three versions are kept, so
a bad release can be undone with `sudo dnf downgrade mtgc`.
- **Back up the signing key**, `~/.local/share/mtgc/gnupg`. It has no
passphrase, so publishing runs unattended. Without it, each machine has to
trust a new key before it takes another update.
- Versions work as on Android: `0.1.<commits on HEAD>`, see
[Distributing to phones](#distributing-to-phones-f-droid).
- The RPM is built against this machine's libraries, so it installs on this
Fedora release and newer.
## Using it
- **Add Cards** — type a name (typos OK); ↑/↓ then Enter adds a copy.
@@ -401,8 +448,9 @@ Repositories**.
installs an update signed with the same key as the installed app, so
without the app key every phone would have to uninstall and reinstall.
- **Versions are automatic.** The Android versionCode is the number of commits
on `HEAD`, and the version shown is e.g. `0.1.0-44-gece21c1`, so any commit
can ship without a bump. That's also why pushed history shouldn't be
on `HEAD`, and the version shown is `0.1.<that count>`, e.g. `0.1.47`, so
any commit can ship without a bump. The major and minor come from
`tauri.conf.json`. That's also why pushed history shouldn't be
rewritten. The script won't publish uncommitted changes without
`--allow-dirty`, or a versionCode the repo already has.
- A phone with a debug build, or anything signed with another key, has to