Add the release tooling (Gitea + AUR + Nostr)
build-aux/release.sh cuts a release from main: it bumps the version in
meson.build/Cargo.toml/Cargo.lock, generates the AppStream release entry from
CHANGELOG.md, builds and signs the distribution tarball, tags it, and publishes
to Gitea (gt release create), the AUR, and Nostr (ngit release publish). Every
outward-facing step is skippable (--no-push/--no-release/--no-aur/--no-nostr),
so a build can be prepared and reviewed before it goes anywhere.
Signing is SSH-only (git's gpg.format=ssh): an annotated tag plus an
ssh-keygen -Y sign detached signature over the tarball. That lets the key stay
on a laptop — run the script under ssh -A and the forwarded agent signs, so the
key material never lands on the build host.
Also:
- CHANGELOG.md: the single source of release notes (Keep a Changelog).
- build-aux/gen-metainfo-releases.py: generates the metainfo <releases> block
from it, translating the version dialect (1.0.0-beta.1 -> 1.0.0~beta.1, with
type=development) and exposing --notes for the release notes text.
- build-aux/aur/{regent,regent-git}: the AUR recipes (release tarball and VCS).
- build-aux/regent-dev: the working-tree package, renamed from regent-git to
make room for the AUR regent-git; deploy-dev.sh --pkg builds this one.
- .ngit/release.yaml: the NIP-82 release manifest (Blossom mirror at
blossom.kosmos.org), replacing the hand-rolled NIP-94/30063/32267 plan.
- Docs: README (install + verify), doc/dev/development.md (Releasing),
AGENTS.md (Releases).
This adds tooling only: it cuts no tag and publishes nothing.
This commit is contained in:
13 files changed
+707
-20
No files matched your search
+2
-2
@@ -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
|
||||
@@ -0,0 +1,39 @@
|
||||
# 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).
|
||||
- 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.sig
|
||||
platform_agnostic: true
|
||||
- file: dist/allowed_signers
|
||||
platform_agnostic: true
|
||||
@@ -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,41 @@ 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
|
||||
|
||||
- **One entry point, run on the build host: `build-aux/release.sh <version>`.** It
|
||||
bumps the version, builds and signs the tarball, tags it, and publishes to
|
||||
Gitea (`gt release create`), the AUR, and Nostr (`ngit release publish`). Every
|
||||
outward-facing step is skippable (`--no-push`, `--no-release`, `--no-aur`,
|
||||
`--no-nostr`) so a build can be prepared and reviewed before it goes anywhere.
|
||||
- **Signing is SSH-only** (`git -c gpg.format=ssh -c user.signingkey=…`): the
|
||||
annotated tag, and an `ssh-keygen -Y sign` detached signature over the tarball.
|
||||
No GPG anywhere. That keeps the key on a laptop — run the script under `ssh -A`
|
||||
and the agent supplies the signature, so the key material never lands on the
|
||||
build host. The script proves it can sign before writing anything.
|
||||
- **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.
|
||||
- **The release commit and its tag are cut before `meson dist`**, because the
|
||||
tarball is built from that commit and the tag has to point at it. Re-signing the
|
||||
commit afterwards would change its hash and invalidate the tarball's provenance.
|
||||
- **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. `release.sh` fills `pkgver`/`_tag`/sha256 and
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
@@ -19,14 +19,33 @@ 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 an SSH signature, and its git tag is
|
||||
signed too. Download `regent-<version>.tar.xz` together with its `.sha256sum`,
|
||||
`.sig` and `allowed_signers` files, then:
|
||||
|
||||
```sh
|
||||
sha256sum -c regent-<version>.tar.xz.sha256sum
|
||||
ssh-keygen -Y verify -f allowed_signers -I raucao@kosmos.org \
|
||||
-n file -s regent-<version>.tar.xz.sig < regent-<version>.tar.xz
|
||||
```
|
||||
|
||||
## Repositories & Contributions
|
||||
|
||||
@@ -55,3 +74,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
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
# Maintainer: Râu Cao <raucao@kosmos.org>
|
||||
#
|
||||
# Stable package: builds the tarball attached to a Gitea release. The AUR copy
|
||||
# always carries a real sha256 — build-aux/release.sh writes it 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
|
||||
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')
|
||||
source=("$pkgname-$_tag.tar.xz::https://gitea.kosmos.org/raucao/regent/releases/download/v$_tag/$pkgname-$_tag.tar.xz")
|
||||
sha256sums=('SKIP') # placeholder; build-aux/release.sh fills in the real hash
|
||||
|
||||
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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Executable
+177
@@ -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')
|
||||
Executable
+261
@@ -0,0 +1,261 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cut a Regent release: bump the version, build and sign the distribution
|
||||
# tarball, tag it, and publish it to Gitea, the AUR and Nostr.
|
||||
#
|
||||
# Signing is SSH-only (git's `gpg.format=ssh`): the annotated tag and a detached
|
||||
# signature over the tarball are made with an SSH key, so the key can stay on
|
||||
# your laptop. Forward your agent for the session and run this on the build host:
|
||||
#
|
||||
# ssh -A user@build-host
|
||||
# build-aux/release.sh 1.0.0-beta.1
|
||||
#
|
||||
# The key comes from REGENT_SIGNING_KEY, else `git config user.signingkey`, else
|
||||
# ~/.ssh/id_ed25519.pub. It is proven to work (the key is present, or an agent
|
||||
# holds it) before anything is written, so a missing key fails up front.
|
||||
#
|
||||
# The run is linear and stops at the first failure. Every outward-facing step
|
||||
# can be turned off, so a build can be prepared and reviewed before it is
|
||||
# published anywhere:
|
||||
#
|
||||
# --draft open the Gitea release as a draft instead of publishing it
|
||||
# --no-push do not push commits or tags to origin/nostr
|
||||
# --no-release do not create the Gitea release
|
||||
# --no-aur do not update the AUR packages
|
||||
# --no-nostr do not publish the Nostr release (ngit)
|
||||
#
|
||||
# `--no-push --no-release --no-aur --no-nostr` builds, commits, tags and signs
|
||||
# locally, then stops. Undo that with
|
||||
# `git reset --soft HEAD~1 && git tag -d vX.Y.Z`.
|
||||
#
|
||||
# Environment:
|
||||
# REGENT_REMOTE, REGENT_NOSTR_REMOTE remote names (origin, nostr)
|
||||
# REGENT_AUR_REGENT, REGENT_AUR_GIT AUR clone URLs
|
||||
# REGENT_SIGNING_KEY SSH public key used to sign
|
||||
# REGENT_BUILD_DIR build directory (default: _build)
|
||||
set -euo pipefail
|
||||
|
||||
log() { printf 'release: %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
|
||||
|
||||
version=
|
||||
draft=no push=yes release=yes aur=yes nostr=yes
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help) usage; exit 0 ;;
|
||||
--draft) draft=yes ;;
|
||||
--no-push) push=no ;;
|
||||
--no-release) release=no ;;
|
||||
--no-aur) aur=no ;;
|
||||
--no-nostr) nostr=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. This is the one place they are derived:
|
||||
# $version tag, Cargo/meson, tarball name, changelog heading
|
||||
# $APPSTREAM metainfo (a '-' separator sorts *above* the final release)
|
||||
# $PKGVER AUR pkgver (pacman wants the dot dropped as well)
|
||||
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")
|
||||
|
||||
hdr "preflight"
|
||||
for tool in git meson appstreamcli python3 ssh-keygen sha256sum; do
|
||||
command -v "$tool" >/dev/null || die "$tool not found"
|
||||
done
|
||||
[ "$release" = no ] || command -v gt >/dev/null || die "gt not found (or pass --no-release)"
|
||||
[ "$aur" = no ] || command -v makepkg >/dev/null || die "makepkg not found (or pass --no-aur)"
|
||||
[ "$nostr" = no ] || command -v ngit >/dev/null || die "ngit not found (or pass --no-nostr)"
|
||||
[ "$release" = no ] || [ "$push" = yes ] \
|
||||
|| die "--no-push needs --no-release (the release needs its tag on the server)"
|
||||
|
||||
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"
|
||||
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"
|
||||
|
||||
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"
|
||||
|
||||
SIGNING_KEY=${REGENT_SIGNING_KEY:-$(git config --get user.signingkey || true)}
|
||||
if [ -z "$SIGNING_KEY" ]; then
|
||||
for candidate in "$HOME/.ssh/id_ed25519.pub" "$HOME/.ssh/id_rsa.pub"; do
|
||||
[ -f "$candidate" ] && SIGNING_KEY=$candidate && break
|
||||
done
|
||||
fi
|
||||
[ -n "$SIGNING_KEY" ] || die "no SSH signing key: set REGENT_SIGNING_KEY or user.signingkey"
|
||||
[ -f "$SIGNING_KEY" ] || die "SSH signing key not found: $SIGNING_KEY"
|
||||
SIGNER_ID=$(git config --get user.email || true)
|
||||
[ -n "$SIGNER_ID" ] || die "set user.email; it is the signer identity in allowed_signers"
|
||||
|
||||
probe=$(mktemp)
|
||||
if ! printf 'probe' > "$probe" \
|
||||
|| ! ssh-keygen -Y sign -f "$SIGNING_KEY" -n regent-probe "$probe" >/dev/null 2>&1; then
|
||||
rm -f "$probe" "$probe.sig"
|
||||
die "cannot sign with $SIGNING_KEY — is its private half present, or an agent forwarded (ssh -A)?"
|
||||
fi
|
||||
rm -f "$probe" "$probe.sig"
|
||||
log "version $version (appstream $APPSTREAM, arch $PKGVER, prerelease: $prerelease)"
|
||||
log "signing as $SIGNER_ID with $SIGNING_KEY"
|
||||
|
||||
hdr "updating the changelog and the version"
|
||||
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 and tagging"
|
||||
git add CHANGELOG.md meson.build Cargo.toml Cargo.lock data/$APP_ID.metainfo.xml.in
|
||||
git -c gpg.format=ssh -c user.signingkey="$SIGNING_KEY" commit -S -m "Release $version"
|
||||
git -c gpg.format=ssh -c user.signingkey="$SIGNING_KEY" tag -s "$tag" -m "Regent $version"
|
||||
|
||||
hdr "building the distribution tarball"
|
||||
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
|
||||
tarball="regent-$version.tar.xz"
|
||||
rm -f "$DIST/$tarball" "$DIST/$tarball.sha256sum" "$DIST/$tarball.sig"
|
||||
mkdir -p "$DIST"
|
||||
cp "$BUILD_DIR/meson-dist/$tarball" "$BUILD_DIR/meson-dist/$tarball.sha256sum" "$DIST/"
|
||||
( cd "$DIST" && sha256sum -c "$tarball.sha256sum" )
|
||||
sha256=$(cut -d' ' -f1 "$DIST/$tarball.sha256sum")
|
||||
ssh-keygen -Y sign -f "$SIGNING_KEY" -n file "$DIST/$tarball"
|
||||
printf '%s %s\n' "$SIGNER_ID" "$(cat "$SIGNING_KEY")" > "$DIST/allowed_signers"
|
||||
python3 build-aux/gen-metainfo-releases.py --notes "$version" CHANGELOG.md > "$DIST/notes.md"
|
||||
log "tarball $DIST/$tarball sha256 $sha256"
|
||||
|
||||
if [ "$push" = yes ]; then
|
||||
hdr "pushing"
|
||||
git push "$REMOTE" main
|
||||
git push "$REMOTE" "$tag"
|
||||
if git remote get-url "$NOSTR_REMOTE" >/dev/null 2>&1; then
|
||||
git push "$NOSTR_REMOTE" main || log "warning: push to $NOSTR_REMOTE main failed (mirror; continuing)"
|
||||
git push "$NOSTR_REMOTE" "$tag" || log "warning: push to $NOSTR_REMOTE $tag failed (mirror; continuing)"
|
||||
else
|
||||
log "no '$NOSTR_REMOTE' remote; skipping the clone mirror"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$release" = yes ]; then
|
||||
hdr "creating the Gitea release"
|
||||
args=(release create "$tag" --verify-tag
|
||||
"$DIST/$tarball"
|
||||
"$DIST/$tarball.sha256sum"
|
||||
"$DIST/$tarball.sig"
|
||||
"$DIST/allowed_signers"
|
||||
build-aux/aur/regent/PKGBUILD
|
||||
-F "$DIST/notes.md")
|
||||
[ "$prerelease" = yes ] && args+=(--prerelease)
|
||||
[ "$draft" = yes ] && args+=(--draft)
|
||||
gt "${args[@]}"
|
||||
fi
|
||||
|
||||
tmp=
|
||||
if [ "$aur" = yes ]; then
|
||||
hdr "updating the AUR"
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
sed -i -e "s/^pkgver=.*/pkgver=$PKGVER/" \
|
||||
-e "s/^_tag=.*/_tag=$version/" \
|
||||
-e "s/^sha256sums=.*/sha256sums=('$sha256')/" \
|
||||
build-aux/aur/regent/PKGBUILD
|
||||
for pkg in regent regent-git; do
|
||||
url=$AUR_REGENT; [ "$pkg" = regent-git ] && url=$AUR_GIT
|
||||
git clone --quiet "$url" "$tmp/$pkg"
|
||||
install -m644 "build-aux/aur/$pkg/PKGBUILD" "$tmp/$pkg/PKGBUILD"
|
||||
( cd "$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
|
||||
fi
|
||||
|
||||
if [ "$nostr" = yes ]; then
|
||||
hdr "publishing the Nostr release"
|
||||
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 -c gpg.format=ssh -c user.signingkey="$SIGNING_KEY" \
|
||||
commit -S -m "Post-release: point the AUR recipe at $version"
|
||||
[ "$push" = yes ] && git push "$REMOTE" main
|
||||
fi
|
||||
fi
|
||||
|
||||
hdr "done"
|
||||
log "released $version (tag $tag)"
|
||||
[ "$release" = yes ] && log "release: https://gitea.kosmos.org/raucao/regent/releases/tag/$tag" || true
|
||||
exit 0
|
||||
@@ -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>
|
||||
+54
-2
@@ -136,7 +136,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,11 +147,63 @@ 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
|
||||
```
|
||||
|
||||
## Releasing
|
||||
|
||||
Releases are cut from `main` with `build-aux/release.sh`, which bumps the
|
||||
version, builds and signs the distribution tarball, tags it, and publishes it to
|
||||
Gitea, the AUR and Nostr:
|
||||
|
||||
```sh
|
||||
build-aux/release.sh 1.0.0-beta.1
|
||||
```
|
||||
|
||||
Signing is **SSH-only** (git's `gpg.format=ssh`): the annotated tag, and a
|
||||
detached signature over the tarball, are made with an SSH key. That lets the key
|
||||
stay on your laptop — forward your agent and run the script on the build host:
|
||||
|
||||
```sh
|
||||
ssh -A user@build-host
|
||||
```
|
||||
|
||||
The key comes from `REGENT_SIGNING_KEY`, else `git config user.signingkey`, else
|
||||
`~/.ssh/id_ed25519.pub`; the script proves it can sign before it writes
|
||||
anything. The publish steps use `gt` (Gitea), `makepkg` (AUR) and `ngit`
|
||||
(Nostr), so those credentials live where the script runs.
|
||||
|
||||
The run is linear and stops at the first failure. Every outward-facing step can
|
||||
be turned off, so a build can be prepared and reviewed before it is published
|
||||
anywhere:
|
||||
|
||||
```sh
|
||||
build-aux/release.sh 1.0.0-beta.1 \
|
||||
--no-push --no-release --no-aur --no-nostr # build, commit, tag and sign only
|
||||
```
|
||||
|
||||
- `--draft` — open the Gitea release as a draft instead of publishing it.
|
||||
- `--no-push`, `--no-release`, `--no-aur`, `--no-nostr` — skip that step.
|
||||
- `REGENT_MESON_DIST_ARGS=--no-tests` — skip `meson dist`'s build-and-test of
|
||||
the tarball (it doubles the build time; the pre-flight build already ran).
|
||||
|
||||
Release notes live in `CHANGELOG.md` and nowhere else. The AppStream release
|
||||
entries are generated from it into the metainfo by
|
||||
`build-aux/gen-metainfo-releases.py` (which `release.sh` runs); do not edit the
|
||||
`releases:begin`/`releases:end` block by hand.
|
||||
|
||||
One version, three dialects, all derived from the one you pass — because both
|
||||
AppStream and pacman order a `-`/`.`-separated pre-release *above* the final
|
||||
release:
|
||||
|
||||
| Where | `1.0.0-beta.1` |
|
||||
| --- | --- |
|
||||
| tag, Cargo, meson, tarball, changelog | `1.0.0-beta.1` |
|
||||
| AppStream metainfo | `1.0.0~beta.1` |
|
||||
| AUR `pkgver` | `1.0.0beta1` |
|
||||
|
||||
## Further reading
|
||||
|
||||
- [GTK 4 documentation](https://docs.gtk.org/gtk4/)
|
||||
|
||||
Reference in new issue
Block a user