Skip to content

Commit 7fccfb9

Browse files
authored
[opt] add local build, update README, add incr check and move releases to nav bar (#3547)
1 parent a8152e0 commit 7fccfb9

656 files changed

Lines changed: 747 additions & 86537 deletions

File tree

Some content is hidden

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

.github/workflows/build-check.yml

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,115 @@ jobs:
7070
exit 1
7171
fi
7272
73+
- name: Detect changed doc versions and locales
74+
id: detect
75+
run: |
76+
BASE_SHA=$(git merge-base origin/${{ github.base_ref }} HEAD)
77+
CHANGED_FILES=$(git diff --name-only "$BASE_SHA" HEAD)
78+
79+
echo "=== Changed files ==="
80+
echo "$CHANGED_FILES"
81+
82+
VERSIONS=""
83+
LOCALES="en"
84+
NEED_FULL_BUILD="false"
85+
86+
# Check each changed file and map to doc version
87+
while IFS= read -r file; do
88+
case "$file" in
89+
# English current (dev) docs
90+
docs/*)
91+
VERSIONS="current,$VERSIONS"
92+
;;
93+
# English versioned docs
94+
versioned_docs/version-*/*)
95+
ver=$(echo "$file" | sed -n 's|versioned_docs/version-\([^/]*\)/.*|\1|p')
96+
VERSIONS="${ver},$VERSIONS"
97+
;;
98+
# Chinese current docs
99+
i18n/zh-CN/docusaurus-plugin-content-docs/current/*)
100+
VERSIONS="current,$VERSIONS"
101+
LOCALES="en,zh-CN"
102+
;;
103+
# Chinese versioned docs
104+
i18n/zh-CN/docusaurus-plugin-content-docs/version-*/*)
105+
ver=$(echo "$file" | sed -n 's|i18n/zh-CN/docusaurus-plugin-content-docs/version-\([^/]*\)/.*|\1|p')
106+
VERSIONS="${ver},$VERSIONS"
107+
LOCALES="en,zh-CN"
108+
;;
109+
# Chinese community docs
110+
i18n/zh-CN/docusaurus-plugin-content-docs-community/*|i18n/zh-CN/code.json)
111+
LOCALES="en,zh-CN"
112+
;;
113+
# Sidebar for current (dev) version
114+
sidebars.ts)
115+
VERSIONS="current,$VERSIONS"
116+
;;
117+
# Versioned sidebars: extract version from filename
118+
# e.g. versioned_sidebars/version-4.x-sidebars.json → 4.x
119+
versioned_sidebars/version-*-sidebars.json)
120+
ver=$(echo "$file" | sed -n 's|versioned_sidebars/version-\(.*\)-sidebars\.json|\1|p')
121+
VERSIONS="${ver},$VERSIONS"
122+
;;
123+
# Blog and community are independent plugins, not
124+
# controlled by DOCS_VERSIONS. They are always built
125+
# regardless of version filtering.
126+
blog/*|community/*)
127+
NEED_BUILD="true"
128+
;;
129+
# Config, source code, or other structural changes
130+
# require a full build to validate
131+
sidebarsCommunity.json|docusaurus.config.js|src/*|static/*|config/*|package.json|yarn.lock|tailwind.config.js)
132+
NEED_FULL_BUILD="true"
133+
;;
134+
esac
135+
done <<< "$CHANGED_FILES"
136+
137+
# Deduplicate versions
138+
if [ "$NEED_FULL_BUILD" = "true" ]; then
139+
# Structural changes: build all active versions
140+
DOCS_VERSIONS=""
141+
echo "Structural changes detected, will build ALL versions."
142+
elif [ -n "$VERSIONS" ]; then
143+
# Only doc content changes: build only affected versions
144+
DOCS_VERSIONS=$(echo "$VERSIONS" | tr ',' '\n' | sort -u | grep -v '^$' | tr '\n' ',' | sed 's/,$//')
145+
echo "Doc-only changes detected for versions: $DOCS_VERSIONS"
146+
else
147+
# No versioned doc changes (e.g., only blog, community, or scripts).
148+
# Blog and community plugins are always compiled by Docusaurus
149+
# regardless of DOCS_VERSIONS, so we just set the minimal docs
150+
# scope to keep the build fast.
151+
DOCS_VERSIONS="current"
152+
echo "No doc version changes detected, doing minimal build with 'current' only."
153+
echo "(Blog and community plugins are always built regardless.)"
154+
fi
155+
156+
# Determine locales for the build command
157+
LOCALE_ARGS=""
158+
IFS=',' read -ra LOCALE_ARR <<< "$LOCALES"
159+
for locale in "${LOCALE_ARR[@]}"; do
160+
LOCALE_ARGS="$LOCALE_ARGS --locale $locale"
161+
done
162+
163+
echo "docs_versions=$DOCS_VERSIONS" >> "$GITHUB_OUTPUT"
164+
echo "locale_args=$LOCALE_ARGS" >> "$GITHUB_OUTPUT"
165+
echo "need_full_build=$NEED_FULL_BUILD" >> "$GITHUB_OUTPUT"
166+
167+
echo ""
168+
echo "=== Build plan ==="
169+
echo " DOCS_VERSIONS: ${DOCS_VERSIONS:-all}"
170+
echo " LOCALE_ARGS: $LOCALE_ARGS"
171+
echo " NEED_FULL_BUILD: $NEED_FULL_BUILD"
172+
73173
- name: Build
174+
env:
175+
DOCS_VERSIONS: ${{ steps.detect.outputs.docs_versions }}
74176
run: |
75177
npm install -g yarn
76178
yarn cache clean
77179
export NODE_OPTIONS=--max-old-space-size=8192
78180
yarn
79-
PWA_SERVICE_WORKER_URL=https://doris.apache.org/sw.js yarn docusaurus build --locale en --locale zh-CN
181+
182+
echo "Building with DOCS_VERSIONS=${DOCS_VERSIONS:-all}"
183+
PWA_SERVICE_WORKER_URL=https://doris.apache.org/sw.js yarn docusaurus build ${{ steps.detect.outputs.locale_args }}
80184
rm -rf build

0 commit comments

Comments
 (0)