__Stage__Deploy_docusaurus #223
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: __Stage__Deploy_docusaurus | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| docBuildBranch: | |
| description: 'doc-build branch to build with' | |
| required: true | |
| default: 'main' | |
| type: string | |
| docVersionsToBuild: | |
| description: 'Build two recent doc versions, or all?' | |
| required: true | |
| default: 'TopTwo' | |
| options: [TopTwo, All] | |
| type: choice | |
| schedule: | |
| - cron: "5 9 * * 1-5" | |
| env: | |
| AWS_KEY: ${{ secrets.AWS_KEY }} | |
| AWS_SECRET: ${{ secrets.AWS_SECRET }} | |
| jobs: | |
| stage_deploy: | |
| env: | |
| INPUTS_BRANCH: "${{ inputs.docBuildBranch || 'main' }}" | |
| INPUTS_VERSIONS: "${{ inputs.docVersionsToBuild || 'All' }}" | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ env.INPUTS_BRANCH }} | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 | |
| 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 | |
| - name: Build website | |
| run: | | |
| export NODE_OPTIONS="--max_old_space_size=15360" | |
| export DOCUSAURUS_IGNORE_SSG_WARNINGS=true | |
| if [[ $INPUTS_VERSIONS == 'TopTwo' ]]; then | |
| export BUILD_FAST=true | |
| fi | |
| yarn build | |
| - name: sync to S3 | |
| env: | |
| BUCKET_SECRET: ${{ secrets.AWS_OSS_DOCS_STAGE_BUCKET }} | |
| run: | | |
| aws s3 sync build/ s3://$BUCKET_SECRET/ --delete $* | |
| - name: clean cdn cache | |
| env: | |
| CLOUFRONT_DIST_ID: ${{ secrets.AWS_OSS_DOCS_STAGE_CLOUDFRONT_DIST_ID }} | |
| run: | | |
| aws cloudfront create-invalidation --distribution-id $CLOUFRONT_DIST_ID --paths "/*" | |