Add the release tooling (Gitea + AUR + Nostr) #7

Merged
raucao merged 3 commits from dev/releases into main 2026-11-29 20:35:07 +00:00
14 changed files with 931 additions and 21 deletions

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@
/target/
*.gresource
*.pkg.tar.*
/build-aux/regent-git/pkg/
/build-aux/regent-git/src/
/build-aux/regent-dev/pkg/
/build-aux/regent-dev/src/
*.log
*.out
+40
View File
@@ -0,0 +1,40 @@
# Release manifest for `ngit release publish`.
#
# Gitea is canonical; this mirrors each release to Nostr (NIP-82 software
# publishing) with the files hosted on Blossom. Publishing needs the release
# identity's signer available to ngit — that is the same npub the repository is
# announced under, and it must stay the same for every release. See
# https://ngit.dev/releases/manifest for the field reference.
schema: 1
identifier: org.kosmos.raucao.Regent
name: Regent
summary: Remote signer for Nostr (NIP-46)
description: |
Regent signs Nostr events and encrypts or decrypts messages on your behalf,
without ever handing your private key to the applications that ask for it.
Applications connect to Regent over NIP-46 (Nostr Connect). Regent shows each
request — the event that would be signed, the message that would be decrypted
— and lets you approve or deny it, so you decide exactly what happens with
your key.
license: Unlicense
website: https://gitea.kosmos.org/raucao/regent
repository: nostr://npub1raustrrh5gjwt03zdj8syn9vmt2dwsv9t467m8c3gua636uxu89svgdees/relay.ngit.dev/regent
icon: data/icons/hicolor/scalable/apps/org.kosmos.raucao.Regent.svg
release_notes: CHANGELOG.md
publication:
blossom_servers:
- https://blossom.kosmos.org
assets:
# The files are produced by build-aux/release.sh in dist/ and expand `{version}`
# to the release version (for example 1.0.0-beta.1). The tarball carries a GPG
# detached signature and the public key that verifies it.
- file: dist/regent-{version}.tar.xz
filename: regent-{version}.tar.xz
platform_agnostic: true
- file: dist/regent-{version}.tar.xz.sha256sum
platform_agnostic: true
- file: dist/regent-{version}.tar.xz.asc
platform_agnostic: true
- file: dist/regent-signing-key.asc
platform_agnostic: true
+43 -2
View File
@@ -1088,8 +1088,9 @@ the UI is tested. `build-aux/deploy-dev.sh` runs on the build host,
GIO falls back to the stable build.
- The two machines must agree on GTK/libadwaita versions; the wrapper compares
them and warns. If they drift, update both before debugging anything else.
- `--pkg` builds `build-aux/regent-git/PKGBUILD`, which packages the working
tree and is a preview of the real release packaging.
- `--pkg` builds `build-aux/regent-dev/PKGBUILD`, which packages the working
tree and is a preview of the real release packaging. (The AUR recipes are
`build-aux/aur/{regent,regent-git}`; see "Releases".)
- The wrapper **updates itself**: it fetches `build-aux/regent-deploy.sh` from the
build host and re-execs when it differs (keeping the previous copy as `.bak`;
`REGENT_DEPLOY_NO_UPDATE=1` skips it). Without that it silently kept running
@@ -1105,6 +1106,46 @@ the UI is tested. `build-aux/deploy-dev.sh` runs on the build host,
still cannot resolve the app. The packaged file is left alone: `/usr/bin` is on
PATH.
## Releases
- **Three stages, split across two machines:
`build-aux/release.sh prepare|sign|publish <version>`.** The build host runs
`prepare` (bump, build, `meson dist`, and an **SSH-signed** release commit);
the laptop runs `sign` (**GPG**: the tag and a detached tarball signature) and
`publish` (Gitea via `gt release create`, the AUR, Nostr via
`ngit release publish`).
- **The commit is SSH-signed, the release is GPG-signed** — that is the point of
the split: the GPG key stays on the laptop and the build host never needs it.
The two formats are set per git command (`-c gpg.format=ssh|openpgp`), so
neither depends on the machine's global config. `prepare` proves it can
SSH-sign before it writes anything.
- **The release commit is cut before `meson dist`** (the tarball is built from it
and the GPG-signed tag points at it); `sign` refuses unless `HEAD` is the commit
`prepare` recorded in `dist/release.env`, so the tag can never point at a
different tree than the tarball.
- **Only `dist/` travels between the machines.** The laptop pulls it from the
build host over SSH (`REGENT_BUILD_HOST`), so nothing has to be sent back.
- **The version exists in three dialects, derived in exactly one place**
(`release.sh`), because AppStream *and* pacman sort a `-`/`.`-separated
pre-release **above** the final release: `1.0.0-beta.1`
(tag/Cargo/meson/tarball/changelog), `1.0.0~beta.1` (metainfo), `1.0.0beta1`
(AUR `pkgver`). Do not "simplify" one of them — `appstreamcli vercmp` and
`vercmp` both disagree with the semver spelling.
- **Release notes live only in `CHANGELOG.md`.** The metainfo `<releases>` block
is generated from it by `build-aux/gen-metainfo-releases.py` (between the
`releases:begin`/`releases:end` markers); never hand-edit the block.
- **The AUR recipes are `build-aux/aur/{regent,regent-git}`** — the stable
tarball package and the VCS one. `publish` fills `pkgver`/`_tag`, the real
sha256, and the signing fingerprint (`validpgpkeys`, with the `.asc` in
`source`), then pushes to `aur.archlinux.org`; the in-repo copy is updated in a
post-release commit, because the sha cannot exist before the tarball does.
`build-aux/regent-dev/` is the *working-tree* package the dev deploy's `--pkg`
builds, not an AUR one.
- **Nostr is a mirror.** `.ngit/release.yaml` publishes the same tarball to
Blossom (`blossom.kosmos.org`) under NIP-82, signed by the fixed release
identity (one npub, forever). Gitea stays canonical, and a Nostr failure is not
fatal to the rest of the release.
## Testing
- Against a real relay — the path that actually matters, and the only one that
+22
View File
@@ -0,0 +1,22 @@
# Changelog
All notable changes to Regent are documented here. The format follows
[Keep a Changelog], and versions are [SemVer]-style: `MAJOR.MINOR.PATCH`, with a
pre-release suffix (for example `1.0.0-beta.1`) for betas.
The AppStream release notes in the metainfo file are generated from this file by
`build-aux/gen-metainfo-releases.py` (run by `build-aux/release.sh`), so this is
the only place release notes are written.
[Keep a Changelog]: https://keepachangelog.com/en/1.1.0/
[SemVer]: https://semver.org/spec/v2.0.0.html
## [Unreleased]
## [0.1.0] - 2026-11-13
### Added
- Initial development snapshot: NIP-46 pairing and approvals, per-app
permissions, the activity log, multiple identities, and a NIP-49 encrypted key
vault with a passphrase.
+29 -5
View File
@@ -19,14 +19,35 @@ sign as different keys at the same time.
## Status
Early development, but usable: NIP-46 pairing and approvals, per-app permissions,
the activity log, multiple identities, and a NIP-49 encrypted key vault with a
passphrase (unlock once, then auto-lock). Packaging and polish are still ahead.
Early development, but usable. The first release is a 1.0 beta: NIP-46 pairing
and approvals, per-app permissions, the activity log, multiple identities, and a
NIP-49 encrypted key vault with a passphrase (unlock once, then auto-lock).
## Installation
Regent is not packaged yet; an [AUR][3] package is planned. Until then, build it
from source — see [Development](doc/dev/development.md).
Regent is not in the official repositories. The first release is a **1.0 beta**,
published on [Gitea][4] and in the [AUR][3]:
```sh
yay -S regent # the release build
yay -S regent-git # tracks main
```
Otherwise build it from source — see [Development](doc/dev/development.md).
### Verifying a release
Every release carries a SHA-256 checksum and a GPG signature, and its git tag is
signed with the same key. Download `regent-<version>.tar.xz` together with its
`.sha256sum`, `.asc` and `regent-signing-key.asc` files, then:
```sh
sha256sum -c regent-<version>.tar.xz.sha256sum
gpg --import regent-signing-key.asc
gpg --verify regent-<version>.tar.xz.asc regent-<version>.tar.xz
```
The same key fingerprint is pinned in the AUR package's `validpgpkeys`.
## Repositories & Contributions
@@ -40,6 +61,8 @@ issues and pull requests are accepted on either:
- [Development](doc/dev/development.md) — prerequisites, building, running, tests
and deployment
- [Releasing](doc/dev/releasing.md) — cutting a release: build, sign, tag, and
publish to Gitea, the AUR and Nostr
- [Advanced usage](doc/advanced.md) — running the signer without a window and
pairing from the CLI
@@ -55,3 +78,4 @@ E-Mail, Chat, Social, Lightning: [raucao@kosmos.org](mailto:raucao@kosmos.org)
[1]: https://nostr.org
[2]: https://github.com/nostr-protocol/nips/blob/master/46.md
[3]: https://aur.archlinux.org/
[4]: https://gitea.kosmos.org/raucao/regent/releases
+35
View File
@@ -0,0 +1,35 @@
# Maintainer: Râu Cao <raucao@kosmos.org>
#
# Development package: tracks the main branch over git. `pkgver()` derives the
# version from the commit count so each new commit sorts higher. For the local
# working tree (uncommitted changes) use build-aux/regent-dev/ instead.
pkgname=regent-git
pkgver=r0.0.0
pkgrel=1
pkgdesc="Remote signer for Nostr (NIP-46) — development build"
arch=('x86_64')
url="https://gitea.kosmos.org/raucao/regent"
license=('Unlicense')
depends=('gtk4' 'libadwaita' 'glib2' 'glibc' 'gcc-libs')
makedepends=('cargo' 'meson' 'blueprint-compiler' 'git')
provides=('regent')
conflicts=('regent')
source=("$pkgname::git+https://gitea.kosmos.org/raucao/regent.git")
sha256sums=('SKIP')
pkgver() {
cd "$pkgname"
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}
build() {
cd "$pkgname"
export CARGO_TARGET_DIR=target
meson setup --prefix=/usr --buildtype=release -Dprofile=default _build
meson compile -C _build
}
package() {
cd "$pkgname"
DESTDIR="$pkgdir" meson install -C _build --no-rebuild
}
+43
View File
@@ -0,0 +1,43 @@
# Maintainer: Râu Cao <raucao@kosmos.org>
#
# Stable package: builds the tarball attached to a Gitea release and checks its
# GPG signature against `_fingerprint`. The AUR copy always carries the real
# sha256 for the tarball and the real fingerprint — build-aux/release.sh writes
# both before pushing. `_tag` is the upstream version; `pkgver` drops the dot in
# a pre-release suffix because pacman orders `1.0.0beta1` below `1.0.0`, while
# `1.0.0beta.1` would be seen as newer (see build-aux/release.sh's arch_version).
pkgname=regent
pkgver=0.1.0
pkgrel=1
_tag=0.1.0
_fingerprint=0000000000000000000000000000000000000000
pkgdesc="Remote signer for Nostr (NIP-46)"
arch=('x86_64')
url="https://gitea.kosmos.org/raucao/regent"
license=('Unlicense')
depends=('gtk4' 'libadwaita' 'glib2' 'glibc' 'gcc-libs')
makedepends=('cargo' 'meson' 'blueprint-compiler')
_release="https://gitea.kosmos.org/raucao/regent/releases/download/v$_tag"
source=("$pkgname-$_tag.tar.xz::$_release/$pkgname-$_tag.tar.xz"
"$pkgname-$_tag.tar.xz.asc::$_release/$pkgname-$_tag.tar.xz.asc")
sha256sums=('SKIP' 'SKIP') # the tarball's hash is filled in by build-aux/release.sh
validpgpkeys=("$_fingerprint")
prepare() {
cd "$pkgname-$_tag"
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target host-tuple
}
build() {
cd "$pkgname-$_tag"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
meson setup --prefix=/usr --buildtype=release -Dprofile=default _build
meson compile -C _build
}
package() {
cd "$pkgname-$_tag"
DESTDIR="$pkgdir" meson install -C _build --no-rebuild
}
+4 -4
View File
@@ -7,7 +7,7 @@
# ssh HOST '<repo>/build-aux/deploy-dev.sh --emit' \
# | tar -x --zstd -C ~/.local
# (default) write that same tarball to a file and print its path
# --pkg build the `regent-git` pacman package and print its path
# --pkg build the `regent-dev` pacman package and print its path
# --versions print the GTK/libadwaita versions this host builds against
#
# REGENT_PROFILE=development builds the nightly `.Devel` identity (its own app id,
@@ -73,10 +73,10 @@ mkdir -p "$OUT_DIR"
if [ "$MODE" = pkg ]; then
command -v makepkg >/dev/null || die "makepkg not found"
log "building regent-git with makepkg"
( cd build-aux/regent-git \
log "building regent-dev with makepkg"
( cd build-aux/regent-dev \
&& REGENT_DEV_PKGVER="$PKGVER" REGENT_REPO="$ROOT" makepkg -f --noconfirm ) >&2
PKG=$(ls -t build-aux/regent-git/regent-git-*.pkg.tar.* | head -1)
PKG=$(ls -t build-aux/regent-dev/regent-dev-*.pkg.tar.* | head -1)
install -m644 "$PKG" "$OUT_DIR/"
printf '%s\n' "$OUT_DIR/$(basename "$PKG")"
exit 0
+177
View File
@@ -0,0 +1,177 @@
#!/usr/bin/env python3
"""Regenerate the AppStream <releases> block in the metainfo template.
Release notes live in CHANGELOG.md (Keep a Changelog, newest first). This turns
the newest entries into <release> elements, applying the two translations
AppStream needs for pre-releases:
* the semver pre-release separator `-` becomes `~`. AppStream sorts
`1.0.0-beta.1` *above* `1.0.0`, but `1.0.0~beta.1` below it — verified with
`appstreamcli vercmp` (and pacman's `vercmp` needs the dot dropped
altogether, which is the AUR recipe's job, not this one),
* a pre-release is marked `type="development"`, so a software centre keeps it
off a stable install's update path.
Everything between the `releases:begin` / `releases:end` comments in the
template is replaced in place; everything else is left alone. The `[Unreleased]`
section and headings without a date are skipped. Run by build-aux/release.sh,
and safe to run by hand.
"""
from __future__ import annotations
import argparse
import re
import sys
from pathlib import Path
from xml.sax.saxutils import escape
BEGIN = "<!-- releases:begin -->"
END = "<!-- releases:end -->"
# "## [1.0.0-beta.1] - 2026-12-01", or without a date (skipped).
HEADING = re.compile(r"^##\s+\[(?P<version>[^\]]+)\](?:\s*-\s*(?P<date>\d{4}-\d{2}-\d{2}))?\s*$")
BULLET = re.compile(r"^[-*]\s+(?P<text>.*\S)\s*$")
def strip_markdown(text: str) -> str:
"""Reduce the little inline markdown the changelog uses to plain text."""
text = re.sub(r"\[([^\]]+)\]\([^)]*\)", r"\1", text) # [text](url) -> text
text = re.sub(r"[*_`]", "", text) # emphasis and code
return text.strip()
def parse_changelog(path: Path, limit: int) -> list[dict]:
releases: list[dict] = []
current: dict | None = None
item = False # is the previous line a still-open bullet?
for raw in path.read_text(encoding="utf-8").splitlines():
line = raw.rstrip()
heading = HEADING.match(line)
if heading:
version = heading.group("version").strip()
date = heading.group("date")
item = False
if version.lower() == "unreleased" or not date or len(releases) >= limit:
current = None
continue
current = {"version": version, "date": date, "items": []}
releases.append(current)
continue
if current is None:
continue
if not line.strip():
item = False
continue
bullet = BULLET.match(line)
if bullet:
text = strip_markdown(bullet.group("text"))
item = bool(text)
if item:
current["items"].append(text)
continue
# A wrapped continuation of the last bullet is indented; anything else
# (a section heading, prose) closes it.
if item and raw[:1].isspace():
text = strip_markdown(line)
if text:
current["items"][-1] = f"{current['items'][-1]} {text}"
continue
item = False
return releases
def appstream_version(version: str) -> str:
return version.replace("-", "~", 1)
def render(releases: list[dict]) -> str:
entries = []
for release in releases:
version = release["version"]
attrs = f'version="{escape(appstream_version(version))}" date="{release["date"]}"'
if "-" in version:
attrs += ' type="development"'
items = release["items"]
if not items:
entries.append(f" <release {attrs}/>")
continue
bullets = "\n".join(f" <li>{escape(item)}</li>" for item in items)
entries.append(
f" <release {attrs}>\n"
f" <description>\n"
f" <ul>\n{bullets}\n </ul>\n"
f" </description>\n"
f" </release>"
)
return "\n".join(entries)
def extract_section(path: Path, version: str) -> str:
"""Return the raw markdown body of one release section, or ''."""
lines = path.read_text(encoding="utf-8").splitlines()
body: list[str] = []
inside = False
for line in lines:
heading = HEADING.match(line)
if heading:
if inside:
break
if heading.group("version").strip() == version:
inside = True
continue
if inside:
body.append(line)
return "\n".join(body).strip()
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("changelog", type=Path)
parser.add_argument("metainfo", type=Path, nargs="?")
parser.add_argument(
"--limit", type=int, default=8,
help="how many of the newest releases to keep (default: 8)",
)
parser.add_argument(
"--notes", metavar="VERSION",
help="print the changelog section for VERSION as markdown and exit",
)
args = parser.parse_args()
if args.notes:
notes = extract_section(args.changelog, args.notes)
if not notes:
print(f"{args.changelog}: no section for {args.notes} (pre-release versions must match the heading)",
file=sys.stderr)
return 1
print(notes)
return 0
if args.metainfo is None:
parser.error("the metainfo file is required unless --notes is given")
text = args.metainfo.read_text(encoding="utf-8")
if BEGIN not in text or END not in text:
print(f"{args.metainfo}: missing {BEGIN} / {END} markers", file=sys.stderr)
return 1
releases = parse_changelog(args.changelog, args.limit)
if not releases:
print(f"{args.changelog}: no dated release headings found", file=sys.stderr)
return 1
before, rest = text.split(BEGIN, 1)
_, after = rest.split(END, 1)
updated = f"{before}{BEGIN}\n{render(releases)}\n {END}{after}"
if updated == text:
print(f"{args.metainfo}: already up to date", file=sys.stderr)
else:
args.metainfo.write_text(updated, encoding="utf-8")
print(f"{args.metainfo}: wrote {len(releases)} release entries", file=sys.stderr)
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -1,11 +1,12 @@
# Maintainer: Râu Cao <raucao@kosmos.org>
# Development package: builds the local working tree rather than a release
# tarball. The released package is `regent` (see the plan), built from a
# tarball attached to a Gitea release.
pkgname=regent-git
# tarball, so uncommitted changes can be packaged. The released package is
# `regent` (build-aux/aur/regent); the AUR development package is `regent-git`
# (build-aux/aur/regent-git).
pkgname=regent-dev
pkgver=${REGENT_DEV_PKGVER:-0.0.0}
pkgrel=1
pkgdesc="Remote signer for Nostr (NIP-46) — development build"
pkgdesc="Remote signer for Nostr (NIP-46) — local working-tree build"
arch=('x86_64')
url="https://gitea.kosmos.org/raucao/regent"
license=('Unlicense')
+413
View File
@@ -0,0 +1,413 @@
#!/usr/bin/env bash
# Cut a Regent release. Three stages, because the release is signed with GPG and
# the GPG key lives on a laptop while the build runs on the build host:
#
# prepare <version> build host: bump, build, commit (SSH), make the tarball
# sign <version> laptop: GPG-sign the tag and the tarball
# publish <version> laptop: Gitea release, AUR, Nostr
#
# The release commit is signed with **SSH** (`gpg.format=ssh`); the tag and the
# detached tarball signature are **GPG**. The two formats are set per git
# command, so neither depends on the machine's global config.
#
# Typical run:
#
# build-host$ build-aux/release.sh prepare 1.0.0-beta.1
# laptop$ build-aux/release.sh sign 1.0.0-beta.1
# laptop$ build-aux/release.sh publish 1.0.0-beta.1
#
# `sign` pulls dist/ from the build host over SSH when it is not there yet, so
# only the artifacts travel (build host -> laptop); nothing needs to come back.
#
# Options:
# --draft publish: open the Gitea release as a draft
# --no-push prepare/publish: do not push commits or tags
# --no-aur publish: do not update the AUR
# --no-nostr publish: do not publish the Nostr release (ngit)
# --no-pull sign: fail instead of pulling dist/ from the build host
#
# Environment:
# REGENT_SSH_SIGNING_KEY SSH public key for the release commit (prepare)
# REGENT_GPG_KEY GPG key id/fingerprint for signing (sign, publish)
# REGENT_BUILD_HOST ssh target to pull dist/ from (sign)
# REGENT_REPO_PATH repo path on the build host (default: ~/src/regent)
# REGENT_REMOTE git remote (default: origin)
# REGENT_NOSTR_REMOTE Nostr git remote (default: nostr)
# REGENT_AUR_REGENT, REGENT_AUR_GIT AUR clone URLs
# REGENT_MESON_DIST_ARGS extra args for `meson dist` (prepare)
# REGENT_BUILD_DIR build directory (default: _build)
set -euo pipefail
log() { printf 'release: %s\n' "$*" >&2; }
warn() { printf 'release: warning: %s\n' "$*" >&2; }
die() { printf 'release: error: %s\n' "$*" >&2; exit 1; }
hdr() { printf '\n\033[1m== %s\033[0m\n' "$*" >&2; }
usage() { awk 'NR>1 && /^#/ {sub(/^# ?/,""); print} NR>1 && !/^#/ {exit}' "${BASH_SOURCE[0]}"; }
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
cd "$ROOT"
APP_ID=org.kosmos.raucao.Regent
REMOTE=${REGENT_REMOTE:-origin}
NOSTR_REMOTE=${REGENT_NOSTR_REMOTE:-nostr}
AUR_REGENT=${REGENT_AUR_REGENT:-ssh://aur@aur.archlinux.org/regent.git}
AUR_GIT=${REGENT_AUR_GIT:-ssh://aur@aur.archlinux.org/regent-git.git}
BUILD_DIR=${REGENT_BUILD_DIR:-_build}
DIST=dist
AUR_TMP=
# --- arguments ---------------------------------------------------------------
stage=${1:-}
case "$stage" in
prepare|sign|publish) shift ;;
-h|--help|'') usage; [ -n "$stage" ] && exit 0 || exit 2 ;;
*) die "unknown stage: $stage (expected prepare, sign or publish; try --help)" ;;
esac
version= draft=no push=yes aur=yes nostr=yes pull=yes
while [ $# -gt 0 ]; do
case "$1" in
--draft) draft=yes ;;
--no-push) push=no ;;
--no-aur) aur=no ;;
--no-nostr) nostr=no ;;
--no-pull) pull=no ;;
-*) die "unknown option: $1 (try --help)" ;;
*) [ -z "$version" ] || die "unexpected argument: $1"; version=$1 ;;
esac
shift
done
[ -n "$version" ] || { usage >&2; exit 2; }
[[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]] \
|| die "version must look like 1.2.3 or 1.2.3-beta.1 (got: $version)"
tag="v$version"
case "$version" in *-*) prerelease=yes ;; *) prerelease=no ;; esac
# The three version dialects, derived in one place. AppStream *and* pacman sort
# a '-'-/'.'-separated pre-release above the final release, so each needs its own
# spelling:
# $version tag, Cargo/meson, tarball name, changelog heading
# $APPSTREAM metainfo (tilde fixes the ordering)
# $PKGVER AUR pkgver (pacman wants the dot dropped too)
appstream_version() { printf '%s' "${1/-/\~}"; }
arch_version() {
local core=${1%%-*} pre
if [ "$core" = "$1" ]; then printf '%s' "$1"; return; fi
pre=${1#*-}
printf '%s%s' "$core" "${pre//./}"
}
APPSTREAM=$(appstream_version "$version")
PKGVER=$(arch_version "$version")
# --- shared helpers ----------------------------------------------------------
require_tools() { for t in "$@"; do command -v "$t" >/dev/null || die "$t not found"; done; }
env_value() { [ -f "$DIST/release.env" ] && sed -n "s/^$1=//p" "$DIST/release.env" | head -1 || true; }
require_clean_main() {
local branch
branch=$(git symbolic-ref --short -q HEAD || true)
[ "$branch" = main ] || die "not on main (on '${branch:-a detached HEAD}')"
git diff --quiet && git diff --cached --quiet || die "the working tree is dirty"
git fetch --quiet "$REMOTE"
[ "$(git rev-parse HEAD)" = "$(git rev-parse "$REMOTE/main")" ] \
|| die "main is not in sync with $REMOTE/main"
}
require_tag_free() {
git rev-parse -q --verify "refs/tags/$tag" >/dev/null && die "tag $tag already exists locally"
git ls-remote --exit-code --tags "$REMOTE" "refs/tags/$tag" >/dev/null 2>&1 \
&& die "tag $tag already exists on $REMOTE"
return 0
}
resolve_ssh_key() {
local key=${REGENT_SSH_SIGNING_KEY:-} configured
if [ -z "$key" ]; then
configured=$(git config --get user.signingkey || true)
case "$configured" in *.pub) key=$configured ;; esac
fi
if [ -z "$key" ]; then
for candidate in "$HOME/.ssh/id_ed25519.pub" "$HOME/.ssh/id_rsa.pub"; do
[ -f "$candidate" ] && key=$candidate && break
done
fi
printf '%s' "$key"
}
probe_ssh_sign() {
local probe; probe=$(mktemp)
if ! printf 'probe' > "$probe" \
|| ! ssh-keygen -Y sign -f "$1" -n regent-probe "$probe" >/dev/null 2>&1; then
rm -f "$probe" "$probe.sig"
die "cannot sign with $1 — is its private half present (and, on a remote build host, an agent forwarded)?"
fi
rm -f "$probe" "$probe.sig"
}
resolve_gpg_key() {
local key=${REGENT_GPG_KEY:-}
if [ -z "$key" ]; then
key=$(gpg --batch --list-secret-keys --with-colons 2>/dev/null | awk -F: '/^sec:/ {print $5; exit}')
fi
[ -n "$key" ] || die "no GPG key: set REGENT_GPG_KEY, or import one (gpg --import)"
printf '%s' "$key"
}
gpg_fingerprint() {
gpg --batch --list-keys --with-colons --fingerprint "$1" 2>/dev/null | awk -F: '/^fpr:/ {print $10; exit}'
}
load_release_env() {
[ -f "$DIST/release.env" ] || die "missing $DIST/release.env (run 'prepare' on the build host first)"
r_version=$(env_value version); r_tag=$(env_value tag); r_commit=$(env_value commit)
r_prerelease=$(env_value prerelease); r_pkgver=$(env_value pkgver); r_fingerprint=$(env_value fingerprint)
[ -n "$r_version" ] && [ -n "$r_commit" ] || die "malformed $DIST/release.env"
[ "$r_version" = "$version" ] || die "$DIST/release.env is for $r_version, not $version"
[ "$r_tag" = "$tag" ] || die "$DIST/release.env tag '$r_tag' does not match '$tag'"
}
verify_tarball() {
[ -f "$DIST/regent-$version.tar.xz" ] || die "missing $DIST/regent-$version.tar.xz"
( cd "$DIST" && sha256sum -c "regent-$version.tar.xz.sha256sum" ) >&2
}
pull_dist() {
[ "$pull" = yes ] || die "$DIST/release.env is missing and --no-pull was given"
[ -n "${REGENT_BUILD_HOST:-}" ] || die "$DIST/release.env is missing; set REGENT_BUILD_HOST to pull it, or copy dist/ over"
require_tools ssh tar
local repo=${REGENT_REPO_PATH:-~/src/regent}
log "pulling dist/ from $REGENT_BUILD_HOST:$repo"
mkdir -p "$DIST"
ssh "$REGENT_BUILD_HOST" "cd $repo && tar -C dist -cf - ." | tar -C "$DIST" -xf -
}
# --- stage: prepare (build host) --------------------------------------------
stage_prepare() {
hdr "preflight"
require_tools git meson appstreamcli python3 sha256sum ssh-keygen
require_clean_main
require_tag_free
local cur_meson cur_cargo ssh_key
cur_meson=$(sed -n "s/.*version: '\(.*\)',.*/\1/p" meson.build | head -1)
cur_cargo=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
[ -n "$cur_meson" ] || die "could not read the version from meson.build"
[ "$cur_meson" = "$cur_cargo" ] \
|| die "meson.build ($cur_meson) and Cargo.toml ($cur_cargo) disagree; fix that first"
appstreamcli vercmp "$cur_meson" "$version" 2>/dev/null | grep -q '<<' \
|| die "$version is not newer than the current $cur_meson"
ssh_key=$(resolve_ssh_key)
[ -n "$ssh_key" ] || die "no SSH signing key: set REGENT_SSH_SIGNING_KEY or user.signingkey"
[ -f "$ssh_key" ] || die "SSH signing key not found: $ssh_key"
probe_ssh_sign "$ssh_key"
log "version $version (appstream $APPSTREAM, arch $PKGVER, prerelease: $prerelease)"
log "commit will be SSH-signed with $ssh_key"
hdr "updating the changelog and the version"
local today; today=$(date +%F)
python3 - "$version" "$today" <<'PY'
import sys
version, today = sys.argv[1], sys.argv[2]
path = "CHANGELOG.md"
text = open(path, encoding="utf-8").read()
if f"## [{version}]" in text:
sys.exit(f"CHANGELOG.md already has a {version} section")
if "## [Unreleased]" not in text:
sys.exit("CHANGELOG.md has no '## [Unreleased]' section; add one first")
text = text.replace("## [Unreleased]", f"## [Unreleased]\n\n## [{version}] - {today}", 1)
open(path, "w", encoding="utf-8").write(text)
PY
sed -i "s/^ version: '.*',/ version: '$version',/" meson.build
sed -i "s/^version = \".*\"/version = \"$version\"/" Cargo.toml
cargo update --offline -p regent >/dev/null
python3 build-aux/gen-metainfo-releases.py CHANGELOG.md data/$APP_ID.metainfo.xml.in
hdr "building and validating"
if [ -d "$BUILD_DIR" ]; then
meson setup --reconfigure "$BUILD_DIR" -Dprofile=default >&2
else
meson setup "$BUILD_DIR" -Dprofile=default >&2
fi
appstreamcli validate --no-net "$BUILD_DIR/data/$APP_ID.metainfo.xml"
desktop-file-validate "$BUILD_DIR/data/$APP_ID.desktop"
glib-compile-schemas --strict --dry-run "$BUILD_DIR/data/"
meson compile -C "$BUILD_DIR" >&2
cargo test --quiet
hdr "committing"
git add CHANGELOG.md meson.build Cargo.toml Cargo.lock data/$APP_ID.metainfo.xml.in
git -c gpg.format=ssh -c user.signingkey="$ssh_key" commit -S -m "Release $version"
hdr "building the distribution tarball"
local dist_args=()
if [ -n "${REGENT_MESON_DIST_ARGS:-}" ]; then
read -r -a dist_args <<< "$REGENT_MESON_DIST_ARGS"
fi
meson dist -C "$BUILD_DIR" ${dist_args[@]+"${dist_args[@]}"} >&2
local tarball="regent-$version.tar.xz"
mkdir -p "$DIST"
rm -f "$DIST/$tarball" "$DIST/$tarball.sha256sum"
cp "$BUILD_DIR/meson-dist/$tarball" "$BUILD_DIR/meson-dist/$tarball.sha256sum" "$DIST/"
( cd "$DIST" && sha256sum -c "$tarball.sha256sum" ) >&2
python3 build-aux/gen-metainfo-releases.py --notes "$version" CHANGELOG.md > "$DIST/notes.md"
hdr "recording the handoff"
cat > "$DIST/release.env" <<EOF
version=$version
tag=$tag
prerelease=$prerelease
appstream=$APPSTREAM
pkgver=$PKGVER
commit=$(git rev-parse HEAD)
EOF
log "tarball $DIST/$tarball (sha256 $(cut -d' ' -f1 "$DIST/$tarball.sha256sum"))"
log "prepared $version at commit $(git rev-parse --short HEAD)"
if [ "$push" = yes ]; then
hdr "pushing main"
git push "$REMOTE" main
if git remote get-url "$NOSTR_REMOTE" >/dev/null 2>&1; then
git push "$NOSTR_REMOTE" main || warn "push to $NOSTR_REMOTE main failed (mirror; continuing)"
fi
fi
hdr "next"
log "next, on the machine with the GPG key:"
log " REGENT_BUILD_HOST=<this-host> build-aux/release.sh sign $version"
}
# --- stage: sign (laptop, GPG) ----------------------------------------------
stage_sign() {
hdr "preflight"
require_tools git gpg sha256sum sed
[ -f "$DIST/release.env" ] || pull_dist
load_release_env
verify_tarball
require_clean_main
[ "$(git rev-parse HEAD)" = "$r_commit" ] \
|| die "HEAD ($(git rev-parse --short HEAD)) is not the prepared commit (${r_commit:0:8}); pull main first"
require_tag_free
local gpg_key fpr
gpg_key=$(resolve_gpg_key)
fpr=$(gpg_fingerprint "$gpg_key")
[ -n "$fpr" ] || die "could not read the fingerprint of GPG key $gpg_key"
log "signing with GPG key $gpg_key ($fpr)"
hdr "signing the tarball"
rm -f "$DIST/regent-$version.tar.xz.asc" "$DIST/regent-signing-key.asc"
gpg --batch --yes --armor --detach-sign --local-user "$gpg_key" "$DIST/regent-$version.tar.xz"
gpg --batch --yes --armor --export "$gpg_key" > "$DIST/regent-signing-key.asc"
gpg --batch --verify "$DIST/regent-$version.tar.xz.asc" "$DIST/regent-$version.tar.xz" >&2
# Record the fingerprint for `publish`, which fills the AUR validpgpkeys.
sed -i '/^fingerprint=/d' "$DIST/release.env"
printf 'fingerprint=%s\n' "$fpr" >> "$DIST/release.env"
hdr "tagging"
git -c gpg.format=openpgp -c user.signingkey="$gpg_key" tag -s "$tag" -m "Regent $version"
git tag -v "$tag" >&2 || die "could not verify the tag just created"
if [ "$push" = yes ]; then
hdr "pushing the tag"
git push "$REMOTE" "$tag"
if git remote get-url "$NOSTR_REMOTE" >/dev/null 2>&1; then
git push "$NOSTR_REMOTE" "$tag" || warn "push to $NOSTR_REMOTE $tag failed (mirror; continuing)"
fi
fi
hdr "next"
log "run: build-aux/release.sh publish $version"
}
# --- stage: publish (laptop) -------------------------------------------------
stage_publish() {
hdr "preflight"
require_tools git gt makepkg sed
[ "$nostr" = no ] || require_tools ngit
load_release_env
verify_tarball
[ -f "$DIST/regent-$version.tar.xz.asc" ] || die "missing $DIST/regent-$version.tar.xz.asc (run 'sign' first)"
[ -n "$r_fingerprint" ] || die "$DIST/release.env has no fingerprint (run 'sign' first)"
require_clean_main
[ "$(git rev-parse HEAD)" = "$r_commit" ] || die "HEAD is not the released commit; check out main and pull"
git rev-parse -q --verify "refs/tags/$tag" >/dev/null || die "tag $tag is missing (run 'sign' first)"
if [ "$push" = no ] && [ "$draft" = no ]; then
warn "publishing without --draft while pushing nothing; the post-release commit will stay local"
fi
hdr "creating the Gitea release"
local args=(release create "$tag" --verify-tag
"$DIST/regent-$version.tar.xz"
"$DIST/regent-$version.tar.xz.sha256sum"
"$DIST/regent-$version.tar.xz.asc"
"$DIST/regent-signing-key.asc"
build-aux/aur/regent/PKGBUILD
-F "$DIST/notes.md")
[ "$prerelease" = yes ] && args+=(--prerelease)
[ "$draft" = yes ] && args+=(--draft)
gt "${args[@]}"
if [ "$aur" = yes ]; then
hdr "updating the AUR"
local sha
sha=$(cut -d' ' -f1 "$DIST/regent-$version.tar.xz.sha256sum")
sed -i -e "s/^pkgver=.*/pkgver=$PKGVER/" \
-e "s/^_tag=.*/_tag=$version/" \
-e "s/^_fingerprint=.*/_fingerprint=$r_fingerprint/" \
-e "s/^sha256sums=.*/sha256sums=('$sha' 'SKIP')/" \
build-aux/aur/regent/PKGBUILD
AUR_TMP=$(mktemp -d)
trap '[ -n "${AUR_TMP:-}" ] && rm -rf "$AUR_TMP"' EXIT
local pkg url
for pkg in regent regent-git; do
url=$AUR_REGENT; [ "$pkg" = regent-git ] && url=$AUR_GIT
git clone --quiet "$url" "$AUR_TMP/$pkg"
install -m644 "build-aux/aur/$pkg/PKGBUILD" "$AUR_TMP/$pkg/PKGBUILD"
( cd "$AUR_TMP/$pkg"
makepkg --printsrcinfo > .SRCINFO
if git diff --quiet && git diff --cached --quiet; then
log "$pkg: no change"
else
git add PKGBUILD .SRCINFO
git commit -q -m "Update to $version"
git push --quiet origin master
log "$pkg: pushed $version"
fi )
done
rm -rf "$AUR_TMP"; AUR_TMP=
fi
if [ "$nostr" = yes ]; then
hdr "publishing the Nostr release"
local channel=main; [ "$prerelease" = yes ] && channel=beta
ngit release publish "$version" --tag "$tag" --channel "$channel"
fi
if [ "$aur" = yes ]; then
hdr "post-release"
git add build-aux/aur/regent/PKGBUILD
if ! git diff --cached --quiet; then
git commit -m "Post-release: point the AUR recipe at $version"
[ "$push" = yes ] && git push "$REMOTE" main
fi
fi
hdr "done"
log "released $version (tag $tag)"
[ "$push" = yes ] && log "release: https://gitea.kosmos.org/raucao/regent/releases/tag/$tag"
return 0
}
case "$stage" in
prepare) stage_prepare ;;
sign) stage_sign ;;
publish) stage_publish ;;
esac
@@ -46,10 +46,16 @@
<content_rating type="oars-1.1"/>
<releases>
<!-- Generated from CHANGELOG.md by build-aux/gen-metainfo-releases.py.
Do not edit by hand; run that helper (or build-aux/release.sh). -->
<!-- releases:begin -->
<release version="0.1.0" date="2026-11-13">
<description>
<p>Initial development snapshot.</p>
<ul>
<li>Initial development snapshot: NIP-46 pairing and approvals, per-app permissions, the activity log, multiple identities, and a NIP-49 encrypted key vault with a passphrase.</li>
</ul>
</description>
</release>
<!-- releases:end -->
</releases>
</component>
+4 -3
View File
@@ -4,7 +4,8 @@ How to build Regent, run it from a build tree, and test it.
> Scope: local setup, building, running, tests and deployment. For running the
> signer unattended and pairing a client from the command line, see
> [Advanced usage](../advanced.md).
> [Advanced usage](../advanced.md); for cutting a release, see
> [Releasing](releasing.md).
## Prerequisites
@@ -136,7 +137,7 @@ that; the previous copy is kept as `regent-deploy.bak`).
Options:
- `REGENT_DEPLOY_PKG=1 regent-deploy` — build and install a real `regent-git`
- `REGENT_DEPLOY_PKG=1 regent-deploy` — build and install a real `regent-dev`
package instead (asks for `sudo`).
- `REGENT_PROFILE=development regent-deploy` — install the nightly `.Devel`
identity instead; it has its own app id, desktop file and data directories, so
@@ -147,7 +148,7 @@ Directly on the build host, with no test machine:
```sh
build-aux/deploy-dev.sh # write a tarball to /tmp/regent-dev/
build-aux/deploy-dev.sh --emit # stream the install tree to stdout
build-aux/deploy-dev.sh --pkg # build the regent-git pacman package
build-aux/deploy-dev.sh --pkg # build the regent-dev pacman package
build-aux/deploy-dev.sh --versions # GTK/libadwaita this host builds against
build-aux/deploy-dev.sh --help
```
+107
View File
@@ -0,0 +1,107 @@
# Releasing
How to cut a Regent release: build it on the build host, sign it on the machine
that holds the GPG key, then publish it to Gitea, the AUR and Nostr.
> Scope: maintainers cutting a release. For local setup, building, running and
> testing, see [Development](development.md).
## Who signs what, and where
The two keys live on different machines, so a release is three stages:
| Stage | Machine | Signs with |
| --- | --- | --- |
| `prepare` | build host | **SSH** — the release commit |
| `sign` | laptop | **GPG** — the tag and the tarball |
| `publish` | laptop | — |
The GPG key never touches the build host. The release **commit** is SSH-signed
(not GPG); the **tag** and the detached tarball signature are GPG.
## Cutting a release
On the build host:
```sh
build-aux/release.sh prepare 1.0.0-beta.1
```
On the machine with the GPG key:
```sh
build-aux/release.sh sign 1.0.0-beta.1
build-aux/release.sh publish 1.0.0-beta.1
```
`sign` pulls `dist/` from the build host over SSH when it is not there yet, so set
`REGENT_BUILD_HOST` there. Each stage is linear and stops at the first failure.
## `prepare` (build host)
Checks that you are on a clean `main` in sync with `origin`, that the tag is
free, and that the version is newer than the current one; then it bumps the
version in `meson.build`/`Cargo.toml`/`Cargo.lock`, closes the `[Unreleased]`
changelog section, regenerates the metainfo, validates, builds and tests, and
commits the result **SSH-signed** (the key comes from `REGENT_SSH_SIGNING_KEY`,
else `git config user.signingkey`, else `~/.ssh/id_ed25519.pub`). It then runs
`meson dist` and leaves the tarball, the checksum, the release notes and a
`release.env` handoff in `dist/`, and pushes `main`.
## `sign` (laptop)
Verifies the tarball against `release.env` and `sha256sum`, then:
- `gpg --armor --detach-sign` → `dist/regent-<version>.tar.xz.asc`,
- exports the public key → `dist/regent-signing-key.asc`,
- `git tag -s` (GPG) and pushes the tag.
The key comes from `REGENT_GPG_KEY`, else the first secret key in the keyring.
## `publish` (laptop)
Creates the Gitea release (the tarball, its `.sha256sum`, its `.asc`, the public
key, the `PKGBUILD` and the notes; pre-releases are marked as such), updates the
AUR recipes — `regent` gains the real sha256, the `.asc` in `source` and the
fingerprint in `validpgpkeys` — publishes the Nostr release, and commits the
in-repo AUR recipe snapshot.
## One version, three dialects
The version you pass is translated for the three ecosystems in `release.sh`,
because AppStream *and* pacman sort a `-`/`.`-separated pre-release **above** the
final release:
| Where | `1.0.0-beta.1` |
| --- | --- |
| git tag, `Cargo.toml`, `meson.build`, tarball, `CHANGELOG.md` | `1.0.0-beta.1` |
| AppStream metainfo | `1.0.0~beta.1` (with `type="development"`) |
| AUR `pkgver` | `1.0.0beta1` |
## Release notes
Release notes live in `CHANGELOG.md` and nowhere else. Write the new section
under `## [Unreleased]` before releasing; `prepare` renames that heading to the
version and date. The AppStream release entries are generated from the same file
by `build-aux/gen-metainfo-releases.py` — do not edit the
`releases:begin`/`releases:end` block by hand.
## Skipping steps
- `--draft` (`publish`) — open the Gitea release as a draft.
- `--no-push` (`prepare`, `sign`, `publish`) — do not push.
- `--no-aur`, `--no-nostr` (`publish`) — skip that destination.
- `--no-pull` (`sign`) — fail instead of pulling `dist/` from the build host.
- `REGENT_MESON_DIST_ARGS=--no-tests` (`prepare`) — skip `meson dist`'s
build-and-test of the tarball.
## One-time setup
- A **GPG** key for signing tags and tarballs, on the laptop; publish its
fingerprint.
- An **SSH** key for signing the release commit, on the build host.
- Gitea: protect `v*` tags; `gt auth login` where `publish` runs.
- AUR: the `regent` and `regent-git` packages, with the AUR SSH key where
`publish` runs.
- Nostr: the ngit signer for the repository's npub, which must stay the same for
every release.