Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .github/workflows/mirror-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,51 +33,3 @@ jobs:
git push
fi

mirror-to-aztec-nr-repo:
runs-on: ubuntu-latest
# Force sequential.
needs: mirror-to-barretenberg-repo
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
- name: Push to aztec-nr repo
run: |
SUBREPO_PATH=noir-projects/aztec-nr
git config --global user.name AztecBot
git config --global user.email tech@aztecprotocol.com

monorepo_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
# list all aztec-packages tags, take the "highest" version
monorepo_tag="$(git tag --list v* | sort --version-sort | tail -1)"
monorepo_protocol_circuits_path="noir-projects/noir-protocol-circuits"

# take all Nargo.toml files that reference noir-protocol-circuits
nargo_files="$(find $SUBREPO_PATH -name 'Nargo.toml' | xargs grep --files-with-matches 'noir-protocol-circuits')"

# match lines like this:
# protocol_types = { path = "../../noir-protocol-circuits/crates/types" }
# and replace with
# protocol_types = { git="https://github.com/aztecprotocol/aztec-packages", tag="v0.16.9", directory="noir-projects/noir-protocol-circuits/crates/types" }
for nargo_file in $nargo_files; do
sed --regexp-extended --in-place \
"s;path\s*=\s*\".*noir-protocol-circuits(.*)\";git=\"$monorepo_url\", tag=\"$monorepo_tag\", directory=\"$monorepo_protocol_circuits_path\1\";" \
$nargo_file
done

git commit --all --message "chore: replace relative paths to noir-protocol-circuits"

if ./scripts/git_subrepo.sh push $SUBREPO_PATH --branch=master; then
git fetch # in case a commit came after this
git rebase origin/master

# restore old files
for nargo_file in $nargo_files; do
git restore --source=origin/master -- $nargo_file
done
git commit --all --amend -m "$(git log -1 --pretty=%B)"

git push
fi
3 changes: 2 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ function release {
# aztec-up => upload scripts to prod if dist tag is latest
# playground => publish if dist tag is latest.
# release-image => push docker image to dist tag.
# boxes/l1-contracts => mirror repo to branch equal to dist tag (master if latest). Also mirror to tag equal to REF_NAME.
# boxes/l1-contracts/aztec-nr => mirror repo to branch equal to dist tag (master if latest). Also mirror to tag equal to REF_NAME.

echo_header "release all"
set -x
Expand All @@ -359,6 +359,7 @@ function release {
barretenberg/ts
noir
l1-contracts
noir-projects/aztec-nr
yarn-project
boxes
aztec-up
Expand Down
12 changes: 0 additions & 12 deletions noir-projects/aztec-nr/.gitrepo

This file was deleted.

75 changes: 74 additions & 1 deletion noir-projects/aztec-nr/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,79 @@ function format {
$NARGO fmt
}

function release {
if semver check $REF_NAME; then
echo_stderr "Release tag must be a valid semver version. Found: $REF_NAME"
exit 1
fi

release_git_push "master" $REF_NAME
}

function release_git_push {
local branch_name=$1
local tag_name=$2
local mirrored_repo_url="https://github.com/AztecProtocol/aztec-nr.git"

# Clean up our release directory.
rm -rf release-out && mkdir release-out

# Copy our git files to our release directory.
git archive HEAD -- . | tar -x -C release-out

cd release-out

# Update Nargo.toml files to reference noir-protocol-circuits from the monorepo tag
monorepo_url="https://github.com/AztecProtocol/aztec-packages"
monorepo_protocol_circuits_path="noir-projects/noir-protocol-circuits"

# Find all Nargo.toml files that reference noir-protocol-circuits
nargo_files="$(find . -name 'Nargo.toml' | xargs grep --files-with-matches 'noir-protocol-circuits' || true)"

# Replace relative paths with git references
for nargo_file in $nargo_files; do
sed --regexp-extended --in-place \
"s;path\s*=\s*\".*noir-protocol-circuits(.*)\";git=\"$monorepo_url\", tag=\"$tag_name\", directory=\"$monorepo_protocol_circuits_path\1\";" \
$nargo_file
done

# CI needs to authenticate from GITHUB_TOKEN.
gh auth setup-git &>/dev/null || true

git init &>/dev/null
git remote add origin "$mirrored_repo_url" &>/dev/null
git fetch origin --quiet

# Checkout the existing branch or create it if it doesn't exist.
if git ls-remote --heads origin "$branch_name" | grep -q "$branch_name"; then
# Update branch reference without checkout.
git branch -f "$branch_name" origin/"$branch_name"
# Point HEAD to the branch.
git symbolic-ref HEAD refs/heads/"$branch_name"
# Move to latest commit, keep working tree.
git reset --soft origin/"$branch_name"
else
git checkout -b "$branch_name"
fi

if git rev-parse "$tag_name" >/dev/null 2>&1; then
echo "Tag $tag_name already exists. Skipping release."
else
git add .
git commit -m "Release $tag_name." >/dev/null
git tag -a "$tag_name" -m "Release $tag_name."
do_or_dryrun git push origin "$branch_name" --quiet
do_or_dryrun git push origin --quiet --force "$tag_name" --tags

echo "Release complete ($tag_name) on branch $branch_name."
fi

do_or_dryrun git push origin "$branch_name" --quiet
do_or_dryrun git push origin --quiet --force "$tag_name" --tags

echo "Release complete ($tag_name) on branch $branch_name."
}

case "$cmd" in
""|"fast"|"full")
build
Expand All @@ -51,7 +124,7 @@ case "$cmd" in
build
test
;;
test|test_cmds|format)
test|test_cmds|format|release)
$cmd
;;
"test-macro-compilation-failure")
Expand Down
Loading