__Prod__Deploy_docusaurus #414
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: __Prod__Deploy_docusaurus | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| docBuildBranch: | |
| description: 'doc-build branch to build with' | |
| required: true | |
| default: 'main' | |
| type: string | |
| schedule: | |
| - cron: "5 10 * * 1-5" | |
| env: | |
| AWS_KEY: ${{ secrets.AWS_KEY }} | |
| AWS_SECRET: ${{ secrets.AWS_SECRET }} | |
| jobs: | |
| prod_deploy: | |
| env: | |
| INPUTS_BRANCH: "${{ inputs.docBuildBranch || 'main' }}" | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ env.INPUTS_BRANCH }} | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 24 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - uses: actions/cache@v3 | |
| id: cache | |
| with: | |
| path: ./node_modules | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_KEY }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET }} | |
| aws-region: us-west-2 | |
| - uses: actions/checkout@v3 | |
| with: | |
| repository: starrocks/starrocks | |
| fetch-depth: 0 | |
| path: ./temp | |
| - name: Install Dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| yarn install --frozen-lockfile | |
| - run: npm run copy | |
| # Fails fast if the CloudFront Function's route exclusions have drifted | |
| # from src/agentDocsRoutes.js — see the script header for why it matters. | |
| - name: Check CloudFront markdown exclusions are in sync | |
| run: node scripts/check-cloudfront-excludes.js | |
| # One locale per `yarn build`. Building all three in a single node process | |
| # peaks above the runner's heap and gets OOM-killed partway through; a | |
| # fresh process per locale stays inside the limit. | |
| # | |
| # This only works because docusaurus.config.js pins the zh and ja | |
| # baseUrls — a single `--locale` disables automatic locale-segment | |
| # inference, so without those pins zh and ja land on build/ and wipe the | |
| # English site. en must run first: it writes to build/, which Docusaurus | |
| # clears before writing. | |
| # A failing locale does not stop the loop. The locales break independently | |
| # — a broken link in the Japanese translation says nothing about English — | |
| # and stopping at the first failure hides the rest, so a red build gets | |
| # fixed one locale per day. All failures are reported together at the end | |
| # and the step still exits non-zero, so the deploy steps below are skipped. | |
| - name: Build website | |
| run: | | |
| export NODE_OPTIONS="--max_old_space_size=12288" | |
| export DOCUSAURUS_PERF_LOGGER=false | |
| export DOCUSAURUS_IGNORE_SSG_WARNINGS=true | |
| export BROWSERSLIST_IGNORE_OLD_DATA=true | |
| failed_locales="" | |
| for locale in en zh ja; do | |
| echo "::group::build ${locale}" | |
| if yarn build --locale "${locale}"; then | |
| echo "locale ${locale}: OK" | |
| else | |
| echo "::error::Locale ${locale} failed to build" | |
| failed_locales="${failed_locales} ${locale}" | |
| fi | |
| echo "::endgroup::" | |
| done | |
| { | |
| echo "| locale | result |" | |
| echo "| --- | --- |" | |
| for locale in en zh ja; do | |
| case " ${failed_locales} " in | |
| *" ${locale} "*) echo "| ${locale} | ❌ failed |" ;; | |
| *) echo "| ${locale} | ✅ ok |" ;; | |
| esac | |
| done | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| if [ -n "${failed_locales}" ]; then | |
| echo "Failed locales:${failed_locales}" | |
| exit 1 | |
| fi | |
| - name: Post-process llms.txt and markdown for agents | |
| run: node scripts/llms-postprocess.js build | |
| # Archived versions flooding the head of the sitemap makes agent checkers | |
| # sampling it conclude Accept: text/markdown is ignored — see the script header. | |
| - name: Check sitemap markdown coverage | |
| run: node scripts/check-sitemap-markdown-coverage.js build | |
| - name: sync to S3 | |
| env: | |
| BUCKET_SECRET: ${{ secrets.AWS_OSS_DOCS_PROD_BUCKET }} | |
| run: | | |
| aws s3 sync build/ s3://$BUCKET_SECRET/ --quiet --delete $* | |
| # Serve Markdown twins as text/markdown so agents (and content | |
| # negotiation) get a readable response body, not a file download. | |
| aws s3 cp build/ s3://$BUCKET_SECRET/ --quiet --recursive \ | |
| --exclude "*" --include "*.md" \ | |
| --content-type "text/markdown; charset=utf-8" | |
| - name: clean cdn cache | |
| env: | |
| CLOUFRONT_DIST_ID: ${{ secrets.AWS_OSS_DOCS_PROD_CLOUDFRONT_DIST_ID }} | |
| run: | | |
| aws cloudfront create-invalidation --distribution-id $CLOUFRONT_DIST_ID --paths "/*" | |