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
22 changes: 12 additions & 10 deletions .github/workflows/mirror_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,30 @@ jobs:
# list all aztec-packages tags, take the "highest" version
monorepo_tag="$(git tag --list aztec-packages-v* | sort --version-sort | tail -1)"
monorepo_protocol_circuits_path="yarn-project/noir-protocol-circuits"
nargo_file="$SUBREPO_PATH/aztec/Nargo.toml"

# 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/src/crates/types" }
# and replace with
# protocol_types = { git="https://github.com/aztecprotocol/aztec-packages", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-protocol-circuits/src/crates/types" }
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
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 Nargo.toml
# We have to go back two generations. History looks like this:
# HEAD <--- the commit generated by git_subrepo
# HEAD~1 <--- the chore commit created above
# HEAD~2 <--- the original commit we were supposed to mirror or the tip of master after rebase
git restore --source=HEAD~2 -- $nargo_file
# 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) [skip ci]"

git push
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-nr/aztec/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0"
type = "lib"

[dependencies]
protocol_types = { git="https://github.com/AztecProtocol/aztec-packages", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-protocol-circuits/src/crates/types" }
protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" }