Skip to content

Commit b1e448d

Browse files
committed
add versioned docs to the pipeline
1 parent 581d8a3 commit b1e448d

File tree

5 files changed

+44
-17
lines changed

5 files changed

+44
-17
lines changed

.github/workflows/pull-from-bazel-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ jobs:
8888
-zip upstream/bazel-bin/src/main/java/com/google/devtools/build/lib/reference-docs.zip \
8989
-output reference-docs-temp
9090
91-
- name: Transform upstream docs to mdx
92-
run: ./copy-upstream-docs.sh
91+
- name: Create or update versioned docs folders
92+
run: ./docs-versions.vendor_folders.sh
9393

9494
- name: Create versioned navigation
9595
run: ./docs.json.update.sh

convert-community-to-mdx.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
set -e
77

8-
FILE=${1}
9-
INPUT_FILE="upstream/site/en/${FILE}/_index.yaml"
8+
# $1 is the source topic (e.g., "community/experts")
9+
# $2 is the destination base path (e.g., "my-docs/community/experts")
10+
SOURCE_TOPIC=${1}
11+
DEST_BASE_PATH=${2}
12+
13+
INPUT_FILE="upstream/site/en/${SOURCE_TOPIC}/_index.yaml"
1014
TITLE=$(yq eval '.landing_page.rows[0].heading' "$INPUT_FILE")
1115
DESCRIPTION=$(yq eval '.landing_page.rows[0].description' "$INPUT_FILE")
1216

13-
OUTPUT_FILE="${FILE}.mdx"
17+
OUTPUT_FILE="${DEST_BASE_PATH}.mdx"
1418
# Create the MDX file
1519
cat > "$OUTPUT_FILE" << EOF
1620
---

copy-upstream-docs.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,17 @@ transform_docs() {
9999
transform_docs "$UPSTREAM_SITE"
100100
transform_docs "$REFERENCE_DOCS"
101101

102-
echo "Converting community YAML files to MDX..."
103-
./convert-community-to-mdx.sh "$DEST_DIR/community/experts"
104-
./convert-community-to-mdx.sh "$DEST_DIR/community/partners"
105-
106-
echo "Copying community images..."
107-
mkdir -p "$DEST_DIR/community/images"
108-
cp upstream/site/en/community/images/* "$DEST_DIR/community/images/"
102+
# Conditionally run the community page generation if the source files exist.
103+
if [ -f "upstream/site/en/community/experts/_index.yaml" ]; then
104+
echo "Converting community YAML files to MDX..."
105+
./convert-community-to-mdx.sh "community/experts" "$DEST_DIR/community/experts"
106+
./convert-community-to-mdx.sh "community/partners" "$DEST_DIR/community/partners"
107+
108+
echo "Copying community images..."
109+
mkdir -p "$DEST_DIR/community/images"
110+
cp upstream/site/en/community/images/* "$DEST_DIR/community/images/"
111+
else
112+
echo "Skipping community file conversion (source not found)."
113+
fi
109114

110115
echo "Done copying docs."

docs-versions.vendor_folders.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ VERSIONS=$(jq -r '.[] | select(. != "HEAD")' docs-versions.json)
1616

1717
# Check which folders are missing and create them
1818
for VERSION in $VERSIONS; do
19-
if [ ! -d "$VERSION" ]; then
19+
if [ ! -d "versions/$VERSION" ]; then
2020
echo "Creating missing folder for version: $VERSION"
2121

2222
# Change to upstream directory and reset to the specific tag
@@ -29,12 +29,30 @@ for VERSION in $VERSIONS; do
2929
cd ..
3030

3131
# Run the copy-upstream-docs.sh script with the version directory
32-
echo "Copying docs to directory: $VERSION"
33-
./copy-upstream-docs.sh "$VERSION"
32+
echo "Copying docs to directory: versions/$VERSION"
33+
./copy-upstream-docs.sh "versions/$VERSION"
34+
35+
echo "Converting community YAML files to MDX..."
36+
37+
# Check and convert experts
38+
if [ -f "upstream/site/en/community/experts/_index.yaml" ]; then
39+
echo "Converting experts for version $VERSION"
40+
./convert-community-to-mdx.sh "community/experts" "versions/$VERSION/community/experts"
41+
else
42+
echo "Skipping experts conversion (file not found for $VERSION)"
43+
fi
44+
45+
# Check and convert partners
46+
if [ -f "upstream/site/en/community/partners/_index.yaml" ]; then
47+
echo "Converting partners for version $VERSION"
48+
./convert-community-to-mdx.sh "community/partners" "versions/$VERSION/community/partners"
49+
else
50+
echo "Skipping partners conversion (file not found for $VERSION)"
51+
fi
3452

3553
echo "Successfully created docs for version $VERSION"
3654
else
37-
echo "Folder $VERSION already exists, skipping"
55+
echo "Folder versions/$VERSION already exists, skipping"
3856
fi
3957
done
4058

update_upstream_locally.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ run ./cleanup-mdx.sh
6262
run ./run-in-go-docker.sh "$REFERENCE_ZIP"
6363

6464

65-
run ./copy-upstream-docs.sh
65+
run ./docs-versions.vendor_folders.sh
6666
run ./docs.json.update.sh
6767

6868
rm -rf "reference-docs-temp"

0 commit comments

Comments
 (0)