From 0513054132664d8fbe6f6a3c9d3ff17c9f81f560 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Fri, 20 Mar 2026 23:01:32 +0000 Subject: [PATCH] chore: publish GitHub releases to AztecProtocol/barretenberg Port of PR #21775 to backport-to-v4-staging. Moves automatic GitHub release creation from aztec-packages to AztecProtocol/barretenberg. Updates all bb artifact download URLs to point to barretenberg releases. bbup tries barretenberg repo first, falls back to aztec-packages. --- .../workflows/copy-bb-release-artifacts.yml | 71 +++++++++++++++++++ barretenberg/bbup/bbup | 12 ++-- barretenberg/cpp/bootstrap.sh | 4 +- barretenberg/rust/barretenberg-rs/README.md | 2 +- barretenberg/rust/barretenberg-rs/build.rs | 2 +- barretenberg/rust/bootstrap.sh | 4 +- bootstrap.sh | 46 +++++------- 7 files changed, 101 insertions(+), 40 deletions(-) create mode 100644 .github-new/workflows/copy-bb-release-artifacts.yml diff --git a/.github-new/workflows/copy-bb-release-artifacts.yml b/.github-new/workflows/copy-bb-release-artifacts.yml new file mode 100644 index 000000000000..3448935bfa3e --- /dev/null +++ b/.github-new/workflows/copy-bb-release-artifacts.yml @@ -0,0 +1,71 @@ +name: Copy BB Release Artifacts +# When a release is published on aztec-packages, copy barretenberg artifacts +# from AztecProtocol/barretenberg to the aztec-packages release. +# Historical bbup versions (~before April 2026) benefit from having these artifacts here. +# Newer bbup versions are able to download experimental nightlies from barretenberg repo. +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "Release tag to copy artifacts for (e.g. v0.82.0)" + required: true + +permissions: + contents: write + +jobs: + copy-artifacts: + runs-on: ubuntu-latest + steps: + - name: Determine tag + id: tag + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" + else + echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" + fi + + - name: Download artifacts from AztecProtocol/barretenberg + env: + GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} + run: | + tag="${{ steps.tag.outputs.tag }}" + echo "Downloading artifacts for tag: $tag" + mkdir -p /tmp/bb-artifacts + + # Download all release assets from the barretenberg repo + if ! gh release download "$tag" \ + --repo AztecProtocol/barretenberg \ + --dir /tmp/bb-artifacts; then + echo "::error::No release found for $tag in AztecProtocol/barretenberg" + exit 1 + fi + + echo "Downloaded artifacts:" + ls -la /tmp/bb-artifacts/ + + - name: Upload artifacts to aztec-packages release + env: + GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} + run: | + tag="${{ steps.tag.outputs.tag }}" + + # Ensure the release exists on aztec-packages (it should if triggered by release event, + # but for workflow_dispatch we may need to verify) + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + if ! gh release view "$tag" --repo AztecProtocol/aztec-packages &>/dev/null; then + echo "::error::No release found for $tag in AztecProtocol/aztec-packages. Create the release first, then re-run." + exit 1 + fi + fi + + echo "Uploading artifacts to aztec-packages release $tag" + gh release upload "$tag" \ + --repo AztecProtocol/aztec-packages \ + --clobber \ + /tmp/bb-artifacts/* + + echo "Done! Artifacts copied to https://github.com/AztecProtocol/aztec-packages/releases/tag/$tag" diff --git a/barretenberg/bbup/bbup b/barretenberg/bbup/bbup index 29d81be28f41..e50950c8e734 100755 --- a/barretenberg/bbup/bbup +++ b/barretenberg/bbup/bbup @@ -114,15 +114,19 @@ install_bb() { local temp_dir=$(mktemp -d) local temp_tar="${temp_dir}/temp.tar.gz" - # Download and extract - local release_url_base="https://github.com/AztecProtocol/aztec-packages/releases/download" + # Download and extract — try AztecProtocol/barretenberg first, fall back to aztec-packages local release_tag="v${version}" if ! version_gte "$version" "0.77.0"; then release_tag="aztec-packages-v${version}" fi - local binary_url="${release_url_base}/${release_tag}/barretenberg-${architecture}-${platform}.tar.gz" + local artifact="barretenberg-${architecture}-${platform}.tar.gz" + local primary_url="https://github.com/AztecProtocol/barretenberg/releases/download/${release_tag}/${artifact}" + local fallback_url="https://github.com/AztecProtocol/aztec-packages/releases/download/${release_tag}/${artifact}" - curl -L --fail "$binary_url" -o "$temp_tar" + if ! curl -sL --fail "$primary_url" -o "$temp_tar"; then + printf "${BLUE}Trying fallback URL...${NC}\n" + curl -L --fail "$fallback_url" -o "$temp_tar" + fi mkdir -p "$BB_PATH" tar xzf "$temp_tar" -C "$BB_PATH" rm -rf "$temp_dir" diff --git a/barretenberg/cpp/bootstrap.sh b/barretenberg/cpp/bootstrap.sh index da73553be6e5..7c3313b1f55d 100755 --- a/barretenberg/cpp/bootstrap.sh +++ b/barretenberg/cpp/bootstrap.sh @@ -441,10 +441,10 @@ function bench { bench_cmds | STRICT_SCHEDULING=1 parallelize } -# Upload assets to release. +# Upload assets to release in AztecProtocol/barretenberg. function release { echo_header "bb cpp release" - do_or_dryrun gh release upload $REF_NAME build-release/* --clobber + do_or_dryrun gh release upload $REF_NAME build-release/* --repo AztecProtocol/barretenberg --clobber } function bench_ivc { diff --git a/barretenberg/rust/barretenberg-rs/README.md b/barretenberg/rust/barretenberg-rs/README.md index 5b182c7ec465..167dd47f2bea 100644 --- a/barretenberg/rust/barretenberg-rs/README.md +++ b/barretenberg/rust/barretenberg-rs/README.md @@ -25,7 +25,7 @@ barretenberg-rs = "0.1" ### PipeBackend (default) -Requires the `bb` binary to be available. Download from [Barretenberg releases](https://github.com/AztecProtocol/aztec-packages/releases). +Requires the `bb` binary to be available. Download from [Barretenberg releases](https://github.com/AztecProtocol/barretenberg/releases). ```rust use barretenberg_rs::{BarretenbergApi, backends::PipeBackend}; diff --git a/barretenberg/rust/barretenberg-rs/build.rs b/barretenberg/rust/barretenberg-rs/build.rs index 8ebc249c7da2..d26cfb87ff68 100644 --- a/barretenberg/rust/barretenberg-rs/build.rs +++ b/barretenberg/rust/barretenberg-rs/build.rs @@ -89,7 +89,7 @@ fn download_lib(out_dir: &PathBuf) { } let url = format!( - "https://github.com/AztecProtocol/aztec-packages/releases/download/v{}/barretenberg-static-{}.tar.gz", + "https://github.com/AztecProtocol/barretenberg/releases/download/v{}/barretenberg-static-{}.tar.gz", version, arch ); diff --git a/barretenberg/rust/bootstrap.sh b/barretenberg/rust/bootstrap.sh index 6626a990fcb0..99dc6ebe0625 100755 --- a/barretenberg/rust/bootstrap.sh +++ b/barretenberg/rust/bootstrap.sh @@ -68,7 +68,7 @@ function release { # Publish to crates.io (--allow-dirty because version was just set and generated files are gitignored) local extra_flags="" - if ! gh release view "v$version" --repo AztecProtocol/aztec-packages &>/dev/null; then + if ! gh release view "v$version" --repo AztecProtocol/barretenberg &>/dev/null; then # No matching GitHub release yet — skip verification build (which would try to download libbb-external.a) echo "No GitHub release found for v$version, adding --no-verify (pass REF_NAME matching a release for full verification)" extra_flags="--no-verify" @@ -96,7 +96,7 @@ function test_download { cargo clean -p barretenberg-rs 2>/dev/null || true # Build with a known release version - local version=${BARRETENBERG_VERSION:-$(gh release list --repo AztecProtocol/aztec-packages --limit 1 --json tagName --jq '.[0].tagName' | sed 's/^v//')} + local version=${BARRETENBERG_VERSION:-$(gh release list --repo AztecProtocol/barretenberg --limit 1 --json tagName --jq '.[0].tagName' | sed 's/^v//')} echo "Testing download with version: $version" # Retry logic for network flakiness (GitHub releases can be flaky) diff --git a/bootstrap.sh b/bootstrap.sh index eb45e77ba30a..dedbaa7ad2e4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -446,36 +446,22 @@ function bench { cache_upload bench-$(git rev-parse HEAD^{tree}).tar.gz bench-out/bench.json } -function release_github { - # Add an easy link for comparing to previous release. - local compare_link="" - if gh release view "v$CURRENT_VERSION" &>/dev/null; then - compare_link=$(echo -e "See changes: https://github.com/AztecProtocol/aztec-packages/compare/v${CURRENT_VERSION}...${COMMIT_HASH}") - fi - # Legacy releases. TODO: Eventually remove. - if gh release view "aztec-packages-v$CURRENT_VERSION" &>/dev/null; then - compare_link=$(echo -e "See changes: https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v${CURRENT_VERSION}...${COMMIT_HASH}") +function release_bb_github { + # Create a GitHub release in AztecProtocol/barretenberg for bb artifacts. + # Users can manually create releases in aztec-packages via the GitHub UI if needed. + local bb_repo="AztecProtocol/barretenberg" + if gh release view "$REF_NAME" --repo "$bb_repo" &>/dev/null; then + return fi - # Determine if this is a prerelease (has a prerelease tag like -rc.1, -alpha, etc.) - local is_prerelease=false + local prerelease_flag="" if [ -n "$(semver prerelease $REF_NAME)" ]; then - is_prerelease=true - fi - # Ensure we have a commit release. - if ! gh release view "$REF_NAME" &>/dev/null; then - local prerelease_flag="" - if $is_prerelease; then - prerelease_flag="--prerelease" - fi - do_or_dryrun gh release create "$REF_NAME" \ - $prerelease_flag \ - --target $COMMIT_HASH \ - --title "$REF_NAME" \ - --notes "$compare_link" - elif ! $is_prerelease; then - # Release exists but this is not a prerelease version - ensure it's marked as a full release - do_or_dryrun gh release edit "$REF_NAME" --prerelease=false + prerelease_flag="--prerelease" fi + do_or_dryrun gh release create "$REF_NAME" \ + --repo "$bb_repo" \ + $prerelease_flag \ + --title "$REF_NAME" \ + --notes "Release $REF_NAME — see https://github.com/AztecProtocol/aztec-packages/commits/$COMMIT_HASH" } function release { @@ -495,9 +481,9 @@ function release { echo_header "release all" set -x - # Ensure we have a github release for our REF_NAME. - # This is in case were are not going through release-please. - release_github + # Ensure we have a github release in AztecProtocol/barretenberg for bb artifacts. + # Users can create aztec-packages releases manually via the GitHub "Create a release" button. + release_bb_github projects=( barretenberg/cpp