From b60a9dcb1aff17717ec3cc3daf46b41f7261348f Mon Sep 17 00:00:00 2001 From: agent Date: Sun, 27 Sep 2026 23:56:58 -0400 Subject: [PATCH] release: ship monero-wallet-rpc beside the binary --- .forgejo/workflows/release.yml | 103 +++++++++++++++++++++++++-------- scripts/build-release-local.sh | 29 +++++++++- 2 files changed, 108 insertions(+), 24 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index ac5e6ef..e19e6f6 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -191,6 +191,14 @@ jobs: TARGET: aarch64-unknown-linux-gnu CARGO_TARGET_VOLUME: onionwire-target-aarch64 BUILD_CONTAINER: onionwire-release-${{ github.run_id }}-aarch64 + # The official Monero release the app ships beside its own binary. Both + # hashes are pinned here and re-checked at build time: the tarball against + # getmonero's signed hashes.txt, and the extracted binary against its own + # value. Bump all four together (see docs/WALLET.md). + MONERO_TARBALL: monero-linux-armv8-v0.18.5.1.tar.bz2 + MONERO_TARBALL_SHA256: c0caf042cb7c7b760f5ad6be188084b59352440b32990a78b8051497b9398dbc + MONERO_ARCHIVE_DIR: monero-aarch64-linux-gnu-v0.18.5.1 + MONERO_WALLET_RPC_SHA256: 75e254b8ebd94d1af4a3df1661135347ee61854efec73c197e8aca0ba7a48dbf steps: - name: Checkout source uses: https://code.forgejo.org/actions/checkout@v4 @@ -212,35 +220,51 @@ jobs: -e CARGO_TARGET_DIR=/target \ -e CARGO_BUILD_JOBS=2 \ -e CARGO_TERM_COLOR=never \ + -e MONERO_TARBALL \ + -e MONERO_TARBALL_SHA256 \ + -e MONERO_ARCHIVE_DIR \ + -e MONERO_WALLET_RPC_SHA256 \ -v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \ -v "$CARGO_TARGET_VOLUME":/target \ -w /src \ "$RUST_IMAGE" \ sh -euxc 'mkdir -p /src && tar xzf - -C /src && cd /src \ && apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true update \ - && apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true install -y --no-install-recommends pkg-config libssl-dev \ + && apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true install -y --no-install-recommends pkg-config libssl-dev bzip2 ca-certificates curl \ && cargo build --release --locked \ && strip /target/release/onionwire \ - && ls -l /target/release/onionwire' + && ls -l /target/release/onionwire \ + && curl -fsSL -o /tmp/hashes.txt https://www.getmonero.org/downloads/hashes.txt \ + && grep -E "^$MONERO_TARBALL_SHA256[[:space:]]+$MONERO_TARBALL$" /tmp/hashes.txt \ + && echo "hashes.txt confirms $MONERO_TARBALL" \ + && curl -fsSL -o /tmp/monero.tar.bz2 "https://downloads.getmonero.org/cli/$MONERO_TARBALL" \ + && echo "$MONERO_TARBALL_SHA256 /tmp/monero.tar.bz2" | sha256sum -c - \ + && tar xjf /tmp/monero.tar.bz2 -C /tmp "$MONERO_ARCHIVE_DIR/monero-wallet-rpc" \ + && mv "/tmp/$MONERO_ARCHIVE_DIR/monero-wallet-rpc" /tmp/monero-wallet-rpc \ + && echo "$MONERO_WALLET_RPC_SHA256 /tmp/monero-wallet-rpc" | sha256sum -c - \ + && ls -l /tmp/monero-wallet-rpc' tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees \ --exclude=./.ci-tools . \ | docker start -a -i "$BUILD_CONTAINER" mkdir -p dist docker cp "$BUILD_CONTAINER:/target/release/onionwire" "dist/onionwire-$TARGET" + docker cp "$BUILD_CONTAINER:/tmp/monero-wallet-rpc" "dist/monero-wallet-rpc-$TARGET" docker rm -f "$BUILD_CONTAINER" > /dev/null - name: Pack and checksum run: | set -euo pipefail cd "${GITHUB_WORKSPACE}/dist" - bytes=$(wc -c < "onionwire-$TARGET") - if [ "$bytes" -eq 0 ]; then - echo "refusing empty binary onionwire-$TARGET" >&2 - exit 1 - fi - file "onionwire-$TARGET" - sha256sum "onionwire-$TARGET" > "onionwire-$TARGET.sha256" - sha256sum -c "onionwire-$TARGET.sha256" + for asset in "onionwire-$TARGET" "monero-wallet-rpc-$TARGET"; do + bytes=$(wc -c < "$asset") + if [ "$bytes" -eq 0 ]; then + echo "refusing empty binary $asset" >&2 + exit 1 + fi + file "$asset" + sha256sum "$asset" > "$asset.sha256" + sha256sum -c "$asset.sha256" + done ls -l - name: Upload dist artifact @@ -259,6 +283,11 @@ jobs: TARGET: x86_64-unknown-linux-gnu CARGO_TARGET_VOLUME: onionwire-target-x86_64 BUILD_CONTAINER: onionwire-release-${{ github.run_id }}-x86_64 + # Same pin as the aarch64 job, for this target. See docs/WALLET.md. + MONERO_TARBALL: monero-linux-x64-v0.18.5.1.tar.bz2 + MONERO_TARBALL_SHA256: 22a7dda7b0cb699fdd6b7674c3b4a4465b337cc98a54983523b759e1e7cc9958 + MONERO_ARCHIVE_DIR: monero-x86_64-linux-gnu-v0.18.5.1 + MONERO_WALLET_RPC_SHA256: c1e3aff7c72837e6f29045c439b772a82b5cd7324c8b831fa825a6ce2019a656 steps: - name: Checkout source uses: https://code.forgejo.org/actions/checkout@v4 @@ -295,35 +324,51 @@ jobs: -e CARGO_TARGET_DIR=/target \ -e CARGO_BUILD_JOBS=2 \ -e CARGO_TERM_COLOR=never \ + -e MONERO_TARBALL \ + -e MONERO_TARBALL_SHA256 \ + -e MONERO_ARCHIVE_DIR \ + -e MONERO_WALLET_RPC_SHA256 \ -v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \ -v "$CARGO_TARGET_VOLUME":/target \ -w /src \ "$RUST_IMAGE" \ sh -euxc 'mkdir -p /src && tar xzf - -C /src && cd /src \ && apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true update \ - && apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true install -y --no-install-recommends pkg-config libssl-dev \ + && apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ForceIPv4=true install -y --no-install-recommends pkg-config libssl-dev bzip2 ca-certificates curl \ && cargo build --release --locked \ && strip /target/release/onionwire \ - && ls -l /target/release/onionwire' + && ls -l /target/release/onionwire \ + && curl -fsSL -o /tmp/hashes.txt https://www.getmonero.org/downloads/hashes.txt \ + && grep -E "^$MONERO_TARBALL_SHA256[[:space:]]+$MONERO_TARBALL$" /tmp/hashes.txt \ + && echo "hashes.txt confirms $MONERO_TARBALL" \ + && curl -fsSL -o /tmp/monero.tar.bz2 "https://downloads.getmonero.org/cli/$MONERO_TARBALL" \ + && echo "$MONERO_TARBALL_SHA256 /tmp/monero.tar.bz2" | sha256sum -c - \ + && tar xjf /tmp/monero.tar.bz2 -C /tmp "$MONERO_ARCHIVE_DIR/monero-wallet-rpc" \ + && mv "/tmp/$MONERO_ARCHIVE_DIR/monero-wallet-rpc" /tmp/monero-wallet-rpc \ + && echo "$MONERO_WALLET_RPC_SHA256 /tmp/monero-wallet-rpc" | sha256sum -c - \ + && ls -l /tmp/monero-wallet-rpc' tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees \ --exclude=./.ci-tools . \ | docker start -a -i "$BUILD_CONTAINER" mkdir -p dist docker cp "$BUILD_CONTAINER:/target/release/onionwire" "dist/onionwire-$TARGET" + docker cp "$BUILD_CONTAINER:/tmp/monero-wallet-rpc" "dist/monero-wallet-rpc-$TARGET" docker rm -f "$BUILD_CONTAINER" > /dev/null - name: Pack and checksum run: | set -euo pipefail cd "${GITHUB_WORKSPACE}/dist" - bytes=$(wc -c < "onionwire-$TARGET") - if [ "$bytes" -eq 0 ]; then - echo "refusing empty binary onionwire-$TARGET" >&2 - exit 1 - fi - file "onionwire-$TARGET" - sha256sum "onionwire-$TARGET" > "onionwire-$TARGET.sha256" - sha256sum -c "onionwire-$TARGET.sha256" + for asset in "onionwire-$TARGET" "monero-wallet-rpc-$TARGET"; do + bytes=$(wc -c < "$asset") + if [ "$bytes" -eq 0 ]; then + echo "refusing empty binary $asset" >&2 + exit 1 + fi + file "$asset" + sha256sum "$asset" > "$asset.sha256" + sha256sum -c "$asset.sha256" + done ls -l - name: Upload dist artifact @@ -384,20 +429,28 @@ jobs: for target in aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu; do src=$(find artifacts -type f -name "onionwire-$target" -print -quit) sum=$(find artifacts -type f -name "onionwire-$target.sha256" -print -quit) - if [ -z "$src" ] || [ -z "$sum" ]; then + wsrc=$(find artifacts -type f -name "monero-wallet-rpc-$target" -print -quit) + wsum=$(find artifacts -type f -name "monero-wallet-rpc-$target.sha256" -print -quit) + if [ -z "$src" ] || [ -z "$sum" ] || [ -z "$wsrc" ] || [ -z "$wsum" ]; then echo "missing artifact for $target" >&2 find artifacts -type f >&2 || true exit 1 fi cp "$src" "dist/onionwire-$target" cp "$sum" "dist/onionwire-$target.sha256" + cp "$wsrc" "dist/monero-wallet-rpc-$target" + cp "$wsum" "dist/monero-wallet-rpc-$target.sha256" done missing=0 for f in \ dist/onionwire-aarch64-unknown-linux-gnu \ dist/onionwire-aarch64-unknown-linux-gnu.sha256 \ + dist/monero-wallet-rpc-aarch64-unknown-linux-gnu \ + dist/monero-wallet-rpc-aarch64-unknown-linux-gnu.sha256 \ dist/onionwire-x86_64-unknown-linux-gnu \ - dist/onionwire-x86_64-unknown-linux-gnu.sha256 + dist/onionwire-x86_64-unknown-linux-gnu.sha256 \ + dist/monero-wallet-rpc-x86_64-unknown-linux-gnu \ + dist/monero-wallet-rpc-x86_64-unknown-linux-gnu.sha256 do bytes=$(wc -c < "$f") echo "on disk: $f $bytes bytes" @@ -416,8 +469,12 @@ jobs: .ci-tools/scripts/release-body.md \ dist/onionwire-aarch64-unknown-linux-gnu \ dist/onionwire-aarch64-unknown-linux-gnu.sha256 \ + dist/monero-wallet-rpc-aarch64-unknown-linux-gnu \ + dist/monero-wallet-rpc-aarch64-unknown-linux-gnu.sha256 \ dist/onionwire-x86_64-unknown-linux-gnu \ - dist/onionwire-x86_64-unknown-linux-gnu.sha256 + dist/onionwire-x86_64-unknown-linux-gnu.sha256 \ + dist/monero-wallet-rpc-x86_64-unknown-linux-gnu \ + dist/monero-wallet-rpc-x86_64-unknown-linux-gnu.sha256 - name: Delete tag we created if this job failed if: failure() && needs.version.outputs.created_tag == 'true' && needs.version.outputs.dry_run != 'true' diff --git a/scripts/build-release-local.sh b/scripts/build-release-local.sh index 7fdf0f1..49fd708 100755 --- a/scripts/build-release-local.sh +++ b/scripts/build-release-local.sh @@ -15,6 +15,17 @@ target=x86_64-unknown-linux-gnu root="$(cd "$(dirname "$0")/.." && pwd)" cd "$root" +# The bundled wallet RPC — the official Monero release binary for this target, +# not something built here (Monero's C++ tree is not part of this build). Both +# values are pinned and both are re-checked on every run: the tarball against +# getmonero's signed hashes.txt, then the extracted binary against its own +# sha256. Bump all four together with the workflow's pins; docs/WALLET.md is the +# provenance record. +monero_tarball=monero-linux-x64-v0.18.5.1.tar.bz2 +monero_tarball_sha256=22a7dda7b0cb699fdd6b7674c3b4a4465b337cc98a54983523b759e1e7cc9958 +monero_archive_dir=monero-x86_64-linux-gnu-v0.18.5.1 +wallet_rpc_sha256=c1e3aff7c72837e6f29045c439b772a82b5cd7324c8b831fa825a6ce2019a656 + expected="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" if [ "$tag" != "v$expected" ]; then echo "warn: tag $tag does not match Cargo.toml version $expected (--version will report $expected)" @@ -31,6 +42,22 @@ strip "dist/$asset" file "dist/$asset" "dist/$asset" --version +echo "==> fetching $monero_tarball" +work="$(mktemp -d)" +trap 'rm -rf "$work"' EXIT +curl -fsSL -o "$work/hashes.txt" https://www.getmonero.org/downloads/hashes.txt +grep -E "^$monero_tarball_sha256[[:space:]]+$monero_tarball$" "$work/hashes.txt" > /dev/null +echo "hashes.txt confirms $monero_tarball" +curl -fsSL -o "$work/monero.tar.bz2" "https://downloads.getmonero.org/cli/$monero_tarball" +echo "$monero_tarball_sha256 $work/monero.tar.bz2" | sha256sum -c - +tar xjf "$work/monero.tar.bz2" -C "$work" "$monero_archive_dir/monero-wallet-rpc" +mv "$work/$monero_archive_dir/monero-wallet-rpc" "$work/monero-wallet-rpc" +echo "$wallet_rpc_sha256 $work/monero-wallet-rpc" | sha256sum -c - +wasset="monero-wallet-rpc-$target" +cp "$work/monero-wallet-rpc" "dist/$wasset" +(cd dist && sha256sum "$wasset" > "$wasset.sha256" && sha256sum -c "$wasset.sha256") +file "dist/$wasset" + echo "==> publishing to the release for $tag" scripts/publish-release.sh "$tag" "OnionWire $tag" scripts/release-body.md \ - "dist/$asset" "dist/$asset.sha256" + "dist/$asset" "dist/$asset.sha256" "dist/$wasset" "dist/$wasset.sha256" \ No newline at end of file