Skip to content

Commit 540d2ba

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/barretenberg
2 parents 1d98ce9 + 6ed0b44 commit 540d2ba

File tree

273 files changed

+40982
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+40982
-41
lines changed

.github/workflows/docs-typesense.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Docs Scraper
33
on:
44
workflow_dispatch:
55
schedule:
6-
# Run the workflow every night at 3:00 AM UTC, after nightly release
7-
- cron: "0 4 * * *"
6+
# Run the workflow every night at 5:00 AM UTC, after nightly release and docs update
7+
- cron: "0 5 * * *"
88
push:
99
branches:
1010
- master
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Nightly Docs Release
2+
3+
on:
4+
schedule:
5+
# Run every night at 4:00 AM UTC, after nightly tags are created
6+
- cron: "0 4 * * *"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Specific nightly tag to use (e.g., v3.0.0-nightly.20241201)"
11+
required: false
12+
13+
permissions:
14+
contents: write
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
19+
jobs:
20+
check-nightly-tag:
21+
name: Check for new nightly tag
22+
runs-on: ubuntu-latest
23+
outputs:
24+
nightly-tag: ${{ steps.get_tag.outputs.tag }}
25+
should-run: ${{ steps.get_tag.outputs.should_run }}
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
29+
with:
30+
fetch-depth: 0
31+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
32+
33+
- name: Get latest nightly tag
34+
id: get_tag
35+
run: |
36+
if [ -n "${{ github.event.inputs.tag }}" ]; then
37+
# Manual trigger with specific tag
38+
NIGHTLY_TAG="${{ github.event.inputs.tag }}"
39+
echo "Using manual tag: $NIGHTLY_TAG"
40+
else
41+
# Get today's nightly tag
42+
current_version=$(jq -r '."."' .release-please-manifest.json)
43+
NIGHTLY_TAG="v${current_version}-nightly.$(date -u +%Y%m%d)"
44+
echo "Expected nightly tag: $NIGHTLY_TAG"
45+
46+
# Check if the tag exists
47+
if ! git tag -l | grep -q "^$NIGHTLY_TAG$"; then
48+
echo "Nightly tag $NIGHTLY_TAG does not exist yet. Skipping docs release."
49+
echo "should_run=false" >> $GITHUB_OUTPUT
50+
exit 0
51+
fi
52+
fi
53+
54+
# Check if we already have docs for this nightly version
55+
DOCS_VERSION_DIR="docs/versioned_docs/version-$NIGHTLY_TAG"
56+
BB_DOCS_VERSION_DIR="barretenberg/docs/versioned_docs/version-$NIGHTLY_TAG"
57+
58+
if [ -d "$DOCS_VERSION_DIR" ] || [ -d "$BB_DOCS_VERSION_DIR" ]; then
59+
echo "Docs already exist for $NIGHTLY_TAG. Skipping."
60+
echo "should_run=false" >> $GITHUB_OUTPUT
61+
else
62+
echo "tag=$NIGHTLY_TAG" >> $GITHUB_OUTPUT
63+
echo "should_run=true" >> $GITHUB_OUTPUT
64+
echo "Will create docs for: $NIGHTLY_TAG"
65+
fi
66+
67+
create-nightly-docs:
68+
name: Create nightly documentation
69+
needs: check-nightly-tag
70+
if: needs.check-nightly-tag.outputs.should-run == 'true'
71+
runs-on: ubuntu-latest
72+
env:
73+
NIGHTLY_TAG: ${{ needs.check-nightly-tag.outputs.nightly-tag }}
74+
75+
steps:
76+
- name: Checkout at nightly tag
77+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
78+
with:
79+
ref: ${{ env.NIGHTLY_TAG }}
80+
fetch-depth: 0
81+
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
82+
83+
- name: Setup dependencies
84+
run: |
85+
sudo apt install -y --no-install-recommends doxygen
86+
corepack enable
87+
88+
- name: Configure Git
89+
run: |
90+
git config --global user.name AztecBot
91+
git config --global user.email [email protected]
92+
93+
- name: Cleanup Aztec docs nightly versions
94+
working-directory: ./docs
95+
run: |
96+
./scripts/cleanup_nightly_versions.sh
97+
98+
- name: Create Aztec nightly docs version
99+
working-directory: ./docs
100+
run: |
101+
# Set the commit tag for version macros
102+
export COMMIT_TAG=${{ env.NIGHTLY_TAG }}
103+
104+
# Install dependencies
105+
yarn install
106+
107+
# Build docs to ensure everything works
108+
COMMIT_TAG=${{ env.NIGHTLY_TAG }} yarn build
109+
110+
# Create the versioned docs
111+
yarn docusaurus docs:version ${{ env.NIGHTLY_TAG }}
112+
113+
echo "Created Aztec docs version: ${{ env.NIGHTLY_TAG }}"
114+
115+
- name: Update Aztec Docs versions.json with new version
116+
working-directory: ./docs/scripts
117+
run: |
118+
./update_versions.sh
119+
120+
- name: Commit new Aztec Docs version
121+
run: |
122+
git add .
123+
git commit -m "chore(docs): cut new aztec docs version for tag ${{ env.NIGHTLY_TAG }}"
124+
git push
125+
126+
- name: Cleanup Barretenberg docs nightly versions
127+
working-directory: ./barretenberg/docs
128+
run: |
129+
./scripts/cleanup_nightly_versions.sh
130+
131+
- name: Create Barretenberg nightly docs version
132+
working-directory: ./barretenberg/docs
133+
run: |
134+
# Set the commit tag for version macros
135+
export COMMIT_TAG=${{ env.NIGHTLY_TAG }}
136+
137+
# Install dependencies
138+
yarn install
139+
140+
# Build docs to ensure everything works
141+
yarn build
142+
143+
# Create the versioned docs
144+
yarn docusaurus docs:version ${{ env.NIGHTLY_TAG }}
145+
146+
echo "Created Barretenberg docs version: ${{ env.NIGHTLY_TAG }}"
147+
148+
- name: Update Barretenberg docs versions.json with new version
149+
working-directory: ./barretenberg/docs/scripts
150+
run: |
151+
./update_versions.sh
152+
153+
- name: Commit new Aztec Docs version
154+
run: |
155+
git add .
156+
git commit -m "chore(docs): cut new aztec docs version for tag ${{ env.NIGHTLY_TAG }}"
157+
git push

barretenberg/docs/docusaurus.config.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,19 @@ const config: Config = {
8282
},
8383
],
8484
],
85-
versions: {
86-
current: {
87-
label: "dev",
85+
// Don't show latest since nightlies are published
86+
includeCurrentVersion: process.env.ENV === "dev",
87+
// There should be 2 versions, nightly and stable
88+
// The stable version is second in the list
89+
lastVersion: versions[1],
90+
...(process.env.ENV === "dev" && {
91+
versions: {
92+
current: {
93+
label: "dev",
94+
path: "dev",
95+
},
8896
},
89-
},
97+
}),
9098
editUrl: (params) => {
9199
return (
92100
`https://github.com/AztecProtocol/aztec-packages/edit/master/docs/docs/` +
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
# Script to clean up nightly documentation versions for Barretenberg
4+
# This removes all versions containing "nightly" from Barretenberg docs
5+
6+
set -e
7+
8+
# Get the directory where the script is located
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
DOCS_DIR="$(dirname "$SCRIPT_DIR")"
11+
12+
# Paths
13+
BARRETENBERG_DOCS_DIR="$DOCS_DIR"
14+
15+
# Function to clean up nightly versions for Barretenberg docs
16+
cleanup_nightly_versions() {
17+
local docs_dir="$1"
18+
local docs_name="$2"
19+
20+
cd "$docs_dir"
21+
22+
# Find nightly versions in versions.json
23+
NIGHTLY_VERSIONS=$(jq -r '.[] | select(test("nightly"))' versions.json 2>/dev/null || echo "")
24+
25+
if [ -z "$NIGHTLY_VERSIONS" ]; then
26+
echo "✅ No nightly versions found in $docs_name versions.json"
27+
else
28+
echo "🔍 Found nightly versions in $docs_name:"
29+
echo "$NIGHTLY_VERSIONS" | sed 's/^/ - /'
30+
31+
# Remove nightly versions from versions.json
32+
echo "🗑️ Removing nightly versions from versions.json..."
33+
jq 'map(select(test("nightly") | not))' versions.json > versions.json.tmp
34+
mv versions.json.tmp versions.json
35+
echo "✅ Updated versions.json"
36+
fi
37+
38+
# Find and remove nightly version directories
39+
VERSIONED_DOCS_DIR="$docs_dir/versioned_docs"
40+
VERSIONED_SIDEBARS_DIR="$docs_dir/versioned_sidebars"
41+
42+
if [ -d "$VERSIONED_DOCS_DIR" ]; then
43+
echo "🔍 Checking for nightly version directories in $docs_name..."
44+
45+
# Find directories containing "nightly"
46+
NIGHTLY_DIRS=$(find "$VERSIONED_DOCS_DIR" -maxdepth 1 -type d -name "*nightly*" 2>/dev/null || true)
47+
48+
if [ -n "$NIGHTLY_DIRS" ]; then
49+
echo "🗑️ Removing nightly version directories:"
50+
echo "$NIGHTLY_DIRS" | while read -r dir; do
51+
if [ -d "$dir" ]; then
52+
echo " - $(basename "$dir")"
53+
rm -rf "$dir"
54+
fi
55+
done
56+
echo "✅ Removed nightly version directories"
57+
else
58+
echo "✅ No nightly version directories found"
59+
fi
60+
fi
61+
62+
if [ -d "$VERSIONED_SIDEBARS_DIR" ]; then
63+
echo "🔍 Checking for nightly sidebar files in $docs_name..."
64+
65+
# Find sidebar files containing "nightly"
66+
NIGHTLY_SIDEBARS=$(find "$VERSIONED_SIDEBARS_DIR" -maxdepth 1 -type f -name "*nightly*" 2>/dev/null || true)
67+
68+
if [ -n "$NIGHTLY_SIDEBARS" ]; then
69+
echo "🗑️ Removing nightly sidebar files:"
70+
echo "$NIGHTLY_SIDEBARS" | while read -r file; do
71+
if [ -f "$file" ]; then
72+
echo " - $(basename "$file")"
73+
rm -f "$file"
74+
fi
75+
done
76+
echo "✅ Removed nightly sidebar files"
77+
else
78+
echo "✅ No nightly sidebar files found"
79+
fi
80+
fi
81+
82+
echo "$docs_name cleanup complete"
83+
}
84+
85+
cleanup_nightly_versions "$BARRETENBERG_DOCS_DIR" "Barretenberg"
Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# This script updates versions.json with the latest version from versioned_docs.
4-
# The resulting versions.json will contain exactly one version (e.g. "v0.85.0")
4+
# It automatically detects if nightly versions exist and includes them appropriately.
55

66
# Get the directory where the script is located
77
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -11,20 +11,75 @@ DOCS_DIR="$(dirname "$SCRIPT_DIR")"
1111
VERSIONS_FILE="$DOCS_DIR/versions.json"
1212
VERSIONED_DOCS_DIR="$DOCS_DIR/versioned_docs"
1313

14-
# Get latest version from versioned_docs/, excluding "Latest"
15-
LATEST_VERSION=$(ls -1 $VERSIONED_DOCS_DIR | sed 's/version-//' | grep -v "Latest" | sort -V | tail -n1)
16-
17-
# Remove "Latest" from versions.json if it exists
18-
if [ -f "$VERSIONS_FILE" ]; then
19-
jq 'map(select(. != "Latest"))' "$VERSIONS_FILE" > "$VERSIONS_FILE.tmp" && mv "$VERSIONS_FILE.tmp" "$VERSIONS_FILE"
14+
# Ensure versions.json exists
15+
if [ ! -f "$VERSIONS_FILE" ]; then
16+
echo "[]" > "$VERSIONS_FILE"
2017
fi
2118

22-
# Create json with the latest version
23-
NEW_VERSIONS=$(jq --null-input --arg version "$LATEST_VERSION" '[ $version ]')
19+
if [ -d "$VERSIONED_DOCS_DIR" ]; then
20+
# Get all versions from versioned_docs/
21+
ALL_VERSIONS=$(ls -1 $VERSIONED_DOCS_DIR | sed 's/version-//' | sort -V)
22+
23+
if [ -n "$ALL_VERSIONS" ]; then
24+
# Separate nightly and non-nightly versions
25+
NIGHTLY_VERSIONS=$(echo "$ALL_VERSIONS" | grep "nightly" | sort -Vr)
26+
NON_NIGHTLY_VERSIONS=$(echo "$ALL_VERSIONS" | grep -v "nightly" | sort -Vr)
27+
28+
# Build versions array with nightly versions first, then stable versions
29+
NEW_VERSIONS="["
30+
FIRST=true
31+
32+
# Add nightly versions first (newest first)
33+
if [ -n "$NIGHTLY_VERSIONS" ]; then
34+
while IFS= read -r version; do
35+
if [ -n "$version" ]; then
36+
if [ "$FIRST" = true ]; then
37+
NEW_VERSIONS="$NEW_VERSIONS\"$version\""
38+
FIRST=false
39+
else
40+
NEW_VERSIONS="$NEW_VERSIONS, \"$version\""
41+
fi
42+
fi
43+
done <<< "$NIGHTLY_VERSIONS"
44+
fi
2445

25-
# Write back to file
26-
echo $NEW_VERSIONS | jq '.' >$VERSIONS_FILE
46+
# Add non-nightly versions (newest first)
47+
if [ -n "$NON_NIGHTLY_VERSIONS" ]; then
48+
while IFS= read -r version; do
49+
if [ -n "$version" ]; then
50+
if [ "$FIRST" = true ]; then
51+
NEW_VERSIONS="$NEW_VERSIONS\"$version\""
52+
FIRST=false
53+
else
54+
NEW_VERSIONS="$NEW_VERSIONS, \"$version\""
55+
fi
56+
fi
57+
done <<< "$NON_NIGHTLY_VERSIONS"
58+
fi
59+
60+
NEW_VERSIONS="$NEW_VERSIONS]"
61+
62+
# Write to versions.json
63+
echo "$NEW_VERSIONS" | jq '.' > "$VERSIONS_FILE"
64+
65+
echo "Updated versions.json successfully"
66+
if [ -n "$NIGHTLY_VERSIONS" ]; then
67+
NIGHTLY_COUNT=$(echo "$NIGHTLY_VERSIONS" | wc -l)
68+
echo "Found $NIGHTLY_COUNT nightly version(s)"
69+
fi
70+
if [ -n "$NON_NIGHTLY_VERSIONS" ]; then
71+
STABLE_COUNT=$(echo "$NON_NIGHTLY_VERSIONS" | wc -l)
72+
echo "Found $STABLE_COUNT stable version(s)"
73+
fi
74+
else
75+
# No versions found, create empty array
76+
echo "[]" > "$VERSIONS_FILE"
77+
echo "No versions found in versioned_docs"
78+
fi
79+
else
80+
echo "Warning: $VERSIONED_DOCS_DIR not found"
81+
echo "[]" > "$VERSIONS_FILE"
82+
fi
2783

28-
echo "Updated versions.json successfully"
29-
echo "New version:"
84+
echo "Current versions.json:"
3085
cat $VERSIONS_FILE
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"label": "Advanced",
3+
"position": 2,
4+
"collapsible": true,
5+
"collapsed": true
6+
}

0 commit comments

Comments
 (0)