Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(release): self-hosted apt+rpm repository publish pipeline (#3100)

mike-inkeep4a9cbd3cf1f2
diff --git a/.github/workflows/publish-linux-repo.yml b/.github/workflows/publish-linux-repo.yml
new file mode 100644
index 000000000..b57ef7deb
--- /dev/null
+++ b/.github/workflows/publish-linux-repo.yml
@@ -0,0 +1,185 @@
+# Publish the Linux apt + rpm repository for one channel.
+#
+# Runs ON THE MIRROR (inkeep/open-knowledge) like the other release
+# workflows — dispatch it there, not on agents-private. It downloads the
+# .deb/.rpm assets from the given GitHub Release, generates a signed
+# repository tree (scripts/linux-repo/publish-linux-repo.sh — stateless,
+# latest-only per channel), and syncs it over the channel's prefixes in the
+# packages bucket. Idempotent: re-running for the same tag converges to the
+# same bucket state.
+#
+# One-time infrastructure setup (bucket, domain, signing key, secrets) and
+# the client-side install instructions live in scripts/linux-repo/README.md.
+#
+# Secrets:
+# LINUX_REPO_GPG_PRIVATE_KEY ASCII-armored private key, NO passphrase
+# LINUX_REPO_R2_ACCESS_KEY_ID / LINUX_REPO_R2_SECRET_ACCESS_KEY
+# LINUX_REPO_R2_ENDPOINT https://<account-id>.r2.cloudflarestorage.com
+# Variables:
+# LINUX_REPO_BUCKET bucket name (e.g. ok-packages)
+
+name: publish-linux-repo
+
+on:
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: "Release tag whose .deb/.rpm assets to publish (e.g. v0.46.0)"
+ required: true
+ channel:
+ description: "Repository channel (apt suite / rpm subdir)"
+ required: true
+ type: choice
+ options: [stable, beta]
+ dry_run:
+ description: "Generate + sign only; skip the bucket sync"
+ type: boolean
+ default: false
+
+# Publishes serialize: two concurrent syncs over the same prefixes could
+# interleave into a half-old half-new repo.
+concurrency:
+ group: publish-linux-repo
+ cancel-in-progress: false
+
+# This job holds the package-signing key and bucket credentials; it needs
+# nothing from the token beyond reading release assets.
+permissions:
+ contents: read
+
+jobs:
+ publish:
+ # Pinned (not -latest): the publish path depends on apt-utils,
+ # createrepo-c, and rpm from the runner image's Ubuntu release — a
+ # surprise image bump must not land mid-release-window.
+ runs-on: ubuntu-24.04
+ timeout-minutes: 20
+ env:
+ # inputs.tag is free-text: NEVER interpolate it into run: blocks
+ # (`${{ }}` splices before the shell parses — command injection in a
+ # job holding the signing key). Reference "$TAG" instead. channel is
+ # a closed choice list but rides the same convention.
+ TAG: ${{ inputs.tag }}
+ CHANNEL: ${{ inputs.channel }}
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+
+ - name: Download release packages
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -euo pipefail
+ mkdir -p /tmp/packages
+ gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \
+ --pattern '*.deb' --pattern '*.rpm' -D /tmp/packages
+ ls -la /tmp/packages
+ count=$(find /tmp/packages -name '*.deb' -o -name '*.rpm' | wc -l)
+ if [ "$count" -eq 0 ]; then
+ echo "::error::release $TAG carries no .deb/.rpm assets — attach the Linux packages first (see scripts/linux-repo/README.md)"
+ exit 1
+ fi
+
+ - name: Install repo tooling
+ run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y --no-install-recommends apt-utils createrepo-c rpm
+
+ - name: Import the signing key
+ env:
+ GPG_PRIVATE_KEY: ${{ secrets.LINUX_REPO_GPG_PRIVATE_KEY }}
+ run: |
+ set -euo pipefail
+ if [ -z "$GPG_PRIVATE_KEY" ]; then
+ echo "::error::LINUX_REPO_GPG_PRIVATE_KEY secret is not set — see scripts/linux-repo/README.md one-time setup"
+ exit 1
+ fi
+ printf '%s\n' "$GPG_PRIVATE_KEY" | gpg --batch --import
+ keyid=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/ {print $5; exit}')
+ if [ -z "$keyid" ]; then
+ echo "::error::gpg imported the secret but no secret key is listed — the LINUX_REPO_GPG_PRIVATE_KEY secret is likely a public key or a truncated/re-wrapped armor block; re-export with 'gpg --armor --export-secret-keys' and set it again"
+ exit 1
+ fi
+ echo "GPG_KEY_ID=$keyid" >> "$GITHUB_ENV"
+
+ - name: Generate + sign the repository tree
+ env:
+ PACKAGES_DIR: /tmp/packages
+ OUT_DIR: /tmp/repo
+ run: bash scripts/linux-repo/publish-linux-repo.sh
+
+ - name: Sync to the packages bucket
+ if: ${{ !inputs.dry_run }}
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.LINUX_REPO_R2_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.LINUX_REPO_R2_SECRET_ACCESS_KEY }}
+ AWS_DEFAULT_REGION: auto
+ ENDPOINT: ${{ secrets.LINUX_REPO_R2_ENDPOINT }}
+ BUCKET: ${{ vars.LINUX_REPO_BUCKET }}
+ run: |
+ set -euo pipefail
+ if [ -z "$BUCKET" ] || [ -z "$ENDPOINT" ]; then
+ echo "::error::LINUX_REPO_BUCKET var / LINUX_REPO_R2_ENDPOINT secret not set — see scripts/linux-repo/README.md"
+ exit 1
+ fi
+ # Upload-first, prune-last — the repo is LIVE during the sync. A
+ # client that fetched the OLD index must still find the OLD pool
+ # files until the NEW index is up, so:
+ # 1. pool/packages WITHOUT --delete (old + new coexist briefly);
+ # 2. metadata (dists/, repodata/) — points at the new files,
+ # which step 1 guaranteed are present;
+ # 3. prune pass with --delete, now that no live index references
+ # the old files.
+ # --delete stays scoped to this channel's prefixes, which is what
+ # keeps the bucket latest-only per channel without touching the
+ # sibling channel.
+ sync() { aws s3 sync --endpoint-url "$ENDPOINT" --no-progress "$@"; }
+ if [ -d "/tmp/repo/apt/pool/$CHANNEL" ]; then
+ sync "/tmp/repo/apt/pool/$CHANNEL" "s3://$BUCKET/apt/pool/$CHANNEL"
+ fi
+ if [ -d "/tmp/repo/rpm/$CHANNEL" ]; then
+ sync "/tmp/repo/rpm/$CHANNEL" "s3://$BUCKET/rpm/$CHANNEL"
+ fi
+ if [ -d "/tmp/repo/apt/dists/$CHANNEL" ]; then
+ sync --delete "/tmp/repo/apt/dists/$CHANNEL" "s3://$BUCKET/apt/dists/$CHANNEL"
+ fi
+ if [ -d "/tmp/repo/apt/pool/$CHANNEL" ]; then
+ sync --delete "/tmp/repo/apt/pool/$CHANNEL" "s3://$BUCKET/apt/pool/$CHANNEL"
+ fi
+ if [ -d "/tmp/repo/rpm/$CHANNEL" ]; then
+ sync --delete "/tmp/repo/rpm/$CHANNEL" "s3://$BUCKET/rpm/$CHANNEL"
+ fi
+ # Public keys: tiny, immutable in practice, never --delete.
+ [ -f /tmp/repo/apt/openknowledge.gpg ] && sync /tmp/repo/apt "s3://$BUCKET/apt" --exclude 'dists/*' --exclude 'pool/*'
+ [ -f /tmp/repo/rpm/key.asc ] && aws s3 cp --endpoint-url "$ENDPOINT" /tmp/repo/rpm/key.asc "s3://$BUCKET/rpm/key.asc"
+ echo "published channel=$CHANNEL from tag=$TAG"
+
+ # Effect-level control: read the LIVE repo back through the public
+ # domain and verify the signature chain, so a partial upload (network
+ # blip, R2 throttle) can't end the run green with an inconsistent
+ # repo. Uses the key imported earlier in this job — the same key the
+ # metadata was signed with moments ago.
+ - name: Verify the published repo
+ if: ${{ !inputs.dry_run }}
+ run: |
+ set -euo pipefail
+ base="https://packages.openknowledge.ai"
+ if [ -d "/tmp/repo/apt/dists/$CHANNEL" ]; then
+ curl -fsSL --retry 5 --retry-delay 3 "$base/apt/dists/$CHANNEL/InRelease" -o /tmp/live-inrelease
+ gpg --batch --verify /tmp/live-inrelease
+ echo "apt InRelease verified for channel=$CHANNEL"
+ fi
+ if [ -d "/tmp/repo/rpm/$CHANNEL" ]; then
+ for arch_dir in /tmp/repo/rpm/"$CHANNEL"/*/; do
+ arch=$(basename "$arch_dir")
+ curl -fsSL --retry 5 --retry-delay 3 "$base/rpm/$CHANNEL/$arch/repodata/repomd.xml" -o /tmp/live-repomd.xml
+ curl -fsSL --retry 5 --retry-delay 3 "$base/rpm/$CHANNEL/$arch/repodata/repomd.xml.asc" -o /tmp/live-repomd.xml.asc
+ gpg --batch --verify /tmp/live-repomd.xml.asc /tmp/live-repomd.xml
+ echo "rpm repomd verified for channel=$CHANNEL arch=$arch"
+ done
+ fi
+
+ - name: Dry-run summary
+ if: ${{ inputs.dry_run }}
+ run: |
+ echo "dry run — tree that WOULD sync:"
+ find /tmp/repo -type f | sort
diff --git a/scripts/linux-repo/README.md b/scripts/linux-repo/README.md
new file mode 100644
index 000000000..4ab00947f
--- /dev/null
+++ b/scripts/linux-repo/README.md
@@ -0,0 +1,134 @@
+# Linux package repository (apt + rpm)
+
+Self-hosted apt/dnf repository for the OpenKnowledge Linux desktop packages,
+served as **static files** from an R2 bucket behind
+`packages.openknowledge.ai`. There is no server component: `apt` and `dnf` do
+all the work client-side; our job is generating correctly-signed metadata and
+uploading it.
+
+Decision context (2026-07-31): the AppImage was cut (its runtime needs FUSE 2,
+which current distros no longer ship), which removed the only in-app
+auto-update path on Linux. This repo IS the Linux update story: users install
+once, then updates arrive through their system package manager.
+
+- Generator: [`publish-linux-repo.sh`](./publish-linux-repo.sh) — stateless,
+ emits metadata for exactly the packages it is given (latest-only per
+ channel). Older versions stay downloadable from their GitHub Releases.
+- Publisher: [`.github/workflows/publish-linux-repo.yml`](../../.github/workflows/publish-linux-repo.yml)
+ — `workflow_dispatch` **on the mirror** (`inkeep/open-knowledge`): give it a
+ release tag + channel; it downloads the release's `.deb`/`.rpm` assets,
+ generates, signs, syncs.
+
+## One-time setup (operator, ~30 min)
+
+1. **Signing key** (do this on a trusted machine, not CI):
+
+ ```bash
+ gpg --batch --gen-key <<'EOF'
+ %no-protection
+ Key-Type: RSA
+ Key-Length: 4096
+ Key-Usage: sign
+ Name-Real: OpenKnowledge Package Signing
+ Name-Email: [email protected]
+ Expire-Date: 0
+ %commit
+ EOF
+ gpg --armor --export-secret-keys [email protected] > ok-packages-signing.key
+ ```
+
+ `%no-protection` (no passphrase) is deliberate: the key's only home is the
+ GitHub secret store and CI signing must be non-interactive. Keep an
+ offline copy somewhere durable (losing it means every user must re-run the
+ install one-liner against a new key).
+
+2. **Bucket + domain**: create an R2 bucket (suggested name `ok-packages`),
+ connect the custom domain `packages.openknowledge.ai` (R2 → bucket →
+ Settings → Custom Domains; this also fronts it with Cloudflare's CDN), and
+ create an R2 API token scoped to that bucket (Object Read & Write).
+
+3. **Secrets + variable on the mirror** (`inkeep/open-knowledge`):
+
+ ```bash
+ gh secret set LINUX_REPO_GPG_PRIVATE_KEY --repo inkeep/open-knowledge < ok-packages-signing.key
+ gh secret set LINUX_REPO_R2_ACCESS_KEY_ID --repo inkeep/open-knowledge
+ gh secret set LINUX_REPO_R2_SECRET_ACCESS_KEY --repo inkeep/open-knowledge
+ gh secret set LINUX_REPO_R2_ENDPOINT --repo inkeep/open-knowledge # https://<account-id>.r2.cloudflarestorage.com
+ gh variable set LINUX_REPO_BUCKET --repo inkeep/open-knowledge --body ok-packages
+ ```
+
+4. Shred the local `ok-packages-signing.key` copy once the offline backup +
+ secret exist.
+
+## Publishing
+
+Prerequisite: the release tag must carry the `.deb` (and, once built, `.rpm`)
+assets. Today the Win/Linux installers are QA-gated workflow artifacts, not
+release assets — attaching them at release-cut time is the remaining
+release-flow integration (tracked below).
+
+```bash
+gh workflow run publish-linux-repo.yml --repo inkeep/open-knowledge \
+ -f tag=v0.46.0 -f channel=stable # add -f dry_run=true to rehearse
+```
+
+Re-running for the same tag is idempotent. Publishing `beta` and `stable`
+never touch each other's prefixes.
+
+## Client install (goes into the docs site when Linux launches)
+
+Debian/Ubuntu:
+
+```bash
+sudo curl -fsSLo /usr/share/keyrings/openknowledge.gpg https://packages.openknowledge.ai/apt/openknowledge.gpg
+echo "deb [signed-by=/usr/share/keyrings/openknowledge.gpg] https://packages.openknowledge.ai/apt stable main" | sudo tee /etc/apt/sources.list.d/openknowledge.list
+sudo apt update && sudo apt install openknowledge
+```
+
+Fedora/RHEL:
+
+```bash
+sudo tee /etc/yum.repos.d/openknowledge.repo <<'EOF'
+[openknowledge]
+name=OpenKnowledge
+baseurl=https://packages.openknowledge.ai/rpm/stable/$basearch/
+enabled=1
+gpgcheck=1
+repo_gpgcheck=1
+gpgkey=https://packages.openknowledge.ai/rpm/key.asc
+EOF
+sudo dnf install openknowledge
+```
+
+Beta channel: replace `stable` with `beta` in either snippet.
+
+## Design notes / known caveats
+
+- **Latest-only, stateless.** Each publish regenerates a channel's metadata
+ from scratch and prunes the previous version from the bucket (`--delete`
+ scoped per channel prefix). No aptly/reprepro database exists anywhere.
+ Sync order (packages before metadata) keeps a live repo from referencing
+ not-yet-uploaded files.
+- **Beta→stable version ordering (deb).** dpkg parses `0.46.0-beta.4` as
+ upstream `0.46.0` + revision `beta.4`, which sorts ABOVE plain `0.46.0`.
+ Within one suite versions increase monotonically, so users tracking a
+ single channel are fine; a user switching beta→stable at the same upstream
+ version won't see the stable build as an upgrade. The Debian-idiomatic fix
+ is emitting `0.46.0~beta.4` (`~` sorts below everything) in the deb Version
+ field at build time — a future electron-builder `fpm`-args refinement, not
+ done yet.
+- **Key rotation** = generate a new key, publish BOTH public keys for a
+ transition window, sign with the new one, update docs. There is no
+ in-band rotation for `signed-by=` keyrings; treat the key as long-lived.
+- **rpm packages are signed individually** (`rpmsign`) AND the repo metadata
+ is signed (`repomd.xml.asc`) — dnf's `gpgcheck=1` + `repo_gpgcheck=1`
+ verify both.
+
+## Remaining integration (not this change)
+
+- Attach the Linux (and Windows) installers to GitHub Releases at cut time —
+ today they only exist as `desktop-build-win-linux.yml` dispatch artifacts.
+- Chain `publish-linux-repo` into the release cadence (beta on every cut,
+ stable on promote) instead of manual dispatch.
+- Docs-site install page + `openknowledge.ai/download/linux` pointing at the
+ one-liners above.
diff --git a/scripts/linux-repo/publish-linux-repo.sh b/scripts/linux-repo/publish-linux-repo.sh
new file mode 100644
index 000000000..e85520d8a
--- /dev/null
+++ b/scripts/linux-repo/publish-linux-repo.sh
@@ -0,0 +1,141 @@
+#!/usr/bin/env bash
+# publish-linux-repo.sh — generate a signed apt + rpm repository tree from a
+# directory of built packages, ready to sync to the packages bucket.
+#
+# STATELESS BY DESIGN: the emitted metadata lists ONLY the packages present in
+# PACKAGES_DIR (one publish = the current version of one channel). The caller
+# syncs the output over the bucket's per-channel prefixes with --delete, so
+# the hosted repo is always "latest per channel" — no repo database, no state
+# to migrate, nothing to corrupt. Older versions remain downloadable from the
+# GitHub Release they shipped on; the repo's job is install + upgrade, not
+# archival.
+#
+# Layout emitted under OUT_DIR (mirrors the bucket layout):
+# apt/openknowledge.gpg binary keyring (signed-by=)
+# apt/key.asc same key, ASCII-armored
+# apt/dists/<channel>/InRelease clearsigned Release
+# apt/dists/<channel>/Release, Release.gpg detached-signature pair
+# apt/dists/<channel>/main/binary-{amd64,arm64}/Packages{,.gz}
+# apt/pool/<channel>/*.deb
+# rpm/key.asc
+# rpm/<channel>/{x86_64,aarch64}/*.rpm + repodata/ (repomd.xml.asc signed)
+#
+# Inputs (env):
+# PACKAGES_DIR directory containing the channel's .deb and .rpm files
+# CHANNEL stable | beta (becomes the apt suite + rpm subdir)
+# OUT_DIR output root (created; must not already contain a run)
+# GPG_KEY_ID key id / fingerprint of the imported signing key
+#
+# Requires: apt-ftparchive (apt-utils), createrepo_c, rpmsign (rpm), gpg.
+# The signing key must already be imported into the default keyring with no
+# passphrase (CI imports it from a secret; see the workflow).
+set -euo pipefail
+
+: "${PACKAGES_DIR:?set PACKAGES_DIR to the directory of .deb/.rpm files}"
+: "${CHANNEL:?set CHANNEL to stable or beta}"
+: "${OUT_DIR:?set OUT_DIR}"
+: "${GPG_KEY_ID:?set GPG_KEY_ID}"
+
+case "$CHANNEL" in stable|beta) ;; *) echo "CHANNEL must be stable|beta, got: $CHANNEL" >&2; exit 2;; esac
+
+shopt -s nullglob
+DEBS=("$PACKAGES_DIR"/*.deb)
+RPMS=("$PACKAGES_DIR"/*.rpm)
+if [ ${#DEBS[@]} -eq 0 ] && [ ${#RPMS[@]} -eq 0 ]; then
+ echo "no .deb or .rpm files in $PACKAGES_DIR — refusing to publish empty metadata" >&2
+ exit 2
+fi
+echo "publishing channel=$CHANNEL: ${#DEBS[@]} deb(s), ${#RPMS[@]} rpm(s)"
+
+# ── apt ────────────────────────────────────────────────────────────────────
+if [ ${#DEBS[@]} -gt 0 ]; then
+ APT="$OUT_DIR/apt"
+ POOL="$APT/pool/$CHANNEL"
+ DIST="$APT/dists/$CHANNEL"
+ mkdir -p "$POOL" "$DIST/main/binary-amd64" "$DIST/main/binary-arm64"
+ # Rename into Debian's `name_version_arch.deb` convention on the way into
+ # the pool: apt-ftparchive's `--arch` filter matches the FILENAME pattern
+ # `*_<arch>.deb`, so electron-builder's `OpenKnowledge-arm64.deb` shape
+ # silently lands in NO per-arch index (empty Packages, "Unable to locate
+ # package" — caught in the VM rehearsal). Fields come from the deb's own
+ # control, so the rename can't drift from the metadata.
+ for deb in "${DEBS[@]}"; do
+ pkg=$(dpkg-deb -f "$deb" Package)
+ ver=$(dpkg-deb -f "$deb" Version)
+ arch=$(dpkg-deb -f "$deb" Architecture)
+ cp "$deb" "$POOL/${pkg}_${ver}_${arch}.deb"
+ done
+
+ # apt-ftparchive emits Filename: relative to the directory it scans from —
+ # run from the apt root so entries read `pool/<channel>/...`, matching the
+ # deb line's URL base.
+ (
+ cd "$APT"
+ for arch in amd64 arm64; do
+ apt-ftparchive --arch "$arch" packages "pool/$CHANNEL" \
+ > "dists/$CHANNEL/main/binary-$arch/Packages"
+ # An empty index is structurally valid (signatures verify, URLs 200)
+ # but users on that arch get "Unable to locate package" — exactly how
+ # the filename-convention bug above first presented. Loud, not fatal:
+ # a deliberately single-arch publish stays possible.
+ if [ ! -s "dists/$CHANNEL/main/binary-$arch/Packages" ]; then
+ echo "warning: Packages index for arch=$arch is EMPTY — no pool deb matched; expected only if this publish intentionally ships no $arch build" >&2
+ fi
+ gzip -9 -k -f "dists/$CHANNEL/main/binary-$arch/Packages"
+ done
+ apt-ftparchive \
+ -o "APT::FTPArchive::Release::Origin=OpenKnowledge" \
+ -o "APT::FTPArchive::Release::Label=OpenKnowledge" \
+ -o "APT::FTPArchive::Release::Suite=$CHANNEL" \
+ -o "APT::FTPArchive::Release::Codename=$CHANNEL" \
+ -o "APT::FTPArchive::Release::Architectures=amd64 arm64" \
+ -o "APT::FTPArchive::Release::Components=main" \
+ release "dists/$CHANNEL" > "dists/$CHANNEL/Release"
+ )
+
+ # Both signature forms: InRelease (modern, single-fetch) + Release.gpg
+ # (older apt). --batch/loopback because CI keys carry no passphrase.
+ gpg --batch --yes --pinentry-mode loopback --local-user "$GPG_KEY_ID" \
+ --clearsign -o "$DIST/InRelease" "$DIST/Release"
+ gpg --batch --yes --pinentry-mode loopback --local-user "$GPG_KEY_ID" \
+ --armor --detach-sign -o "$DIST/Release.gpg" "$DIST/Release"
+
+ # signed-by= wants a binary keyring; the .asc is for humans + docs.
+ gpg --export "$GPG_KEY_ID" > "$APT/openknowledge.gpg"
+ gpg --armor --export "$GPG_KEY_ID" > "$APT/key.asc"
+fi
+
+# ── rpm ────────────────────────────────────────────────────────────────────
+if [ ${#RPMS[@]} -gt 0 ]; then
+ RPMROOT="$OUT_DIR/rpm"
+ mkdir -p "$RPMROOT"
+ # rpmsign resolves its key through the rpm macro, not a CLI flag.
+ echo "%_gpg_name $GPG_KEY_ID" > "$HOME/.rpmmacros"
+
+ for rpm in "${RPMS[@]}"; do
+ base=$(basename "$rpm")
+ case "$base" in
+ *x86_64*) arch=x86_64 ;;
+ *aarch64*|*arm64*) arch=aarch64 ;;
+ *) echo "cannot infer arch from rpm filename: $base" >&2; exit 2 ;;
+ esac
+ dest="$RPMROOT/$CHANNEL/$arch"
+ mkdir -p "$dest"
+ cp "$rpm" "$dest/"
+ # Package-level signature — dnf's default gpgcheck=1 verifies THIS, not
+ # just the repo metadata signature.
+ rpmsign --addsign "$dest/$base" >/dev/null
+ done
+
+ for dir in "$RPMROOT/$CHANNEL"/*/; do
+ createrepo_c --general-compress-type=gz "$dir" >/dev/null
+ # repo_gpgcheck=1 verifies this detached signature over the metadata index.
+ gpg --batch --yes --pinentry-mode loopback --local-user "$GPG_KEY_ID" \
+ --armor --detach-sign -o "$dir/repodata/repomd.xml.asc" "$dir/repodata/repomd.xml"
+ done
+
+ gpg --armor --export "$GPG_KEY_ID" > "$RPMROOT/key.asc"
+fi
+
+echo "repo tree ready under $OUT_DIR:"
+find "$OUT_DIR" -type f | sort