Merge pull request #2981 from redis/rc_api_sync #10576
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: build_docs | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| env: | |
| HUGO_VERSION: 0.143.1 | |
| BUCKET: docs-prod-learn-redis-com | |
| jobs: | |
| # Discover versions and build the latest docs | |
| setup_and_build_latest: | |
| name: Setup and build latest docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| outputs: | |
| kubernetes_versions: ${{ steps.discover.outputs.kubernetes_versions }} | |
| rs_versions: ${{ steps.discover.outputs.rs_versions }} | |
| rdi_versions: ${{ steps.discover.outputs.rdi_versions }} | |
| redisvl_versions: ${{ steps.discover.outputs.redisvl_versions }} | |
| hugo_root_path: ${{ steps.set-paths.outputs.hugo_root_path }} | |
| bucket_path: ${{ steps.set-paths.outputs.bucket_path }} | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| - name: Validate the branch name | |
| env: | |
| BRANCH_NAME: ${{ github.ref_name }} | |
| run: | | |
| if [[ "$BRANCH_NAME" =~ ^[a-zA-Z0-9_.-]+$ ]]; then | |
| echo "The branch name $BRANCH_NAME is valid." | |
| else | |
| echo "ERROR: Invalid branch name $BRANCH_NAME!" | |
| exit 1 | |
| fi | |
| - name: Install Hugo | |
| run: | | |
| wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
| && sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
| - name: Check the branch out | |
| uses: actions/checkout@v4 | |
| - name: Set paths | |
| id: set-paths | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "main" ]]; then | |
| echo "hugo_root_path=docs/staging/dev" >> $GITHUB_OUTPUT | |
| echo "bucket_path=staging/dev" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref_name }}" == "latest" ]]; then | |
| echo "hugo_root_path=docs/latest" >> $GITHUB_OUTPUT | |
| echo "bucket_path=latest" >> $GITHUB_OUTPUT | |
| elif [[ "${{ endsWith(github.ref_name, '-build') }}" == "true" ]]; then | |
| path=$(echo "docs/version/${{ github.ref_name }}" | sed 's/-build$//') | |
| bucket=$(echo "version/${{ github.ref_name }}" | sed 's/-build$//') | |
| echo "hugo_root_path=${path}" >> $GITHUB_OUTPUT | |
| echo "bucket_path=${bucket}" >> $GITHUB_OUTPUT | |
| else | |
| echo "hugo_root_path=docs/staging/${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| echo "bucket_path=staging/${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Discover versions | |
| id: discover | |
| run: | | |
| kubernetes_versions=$(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| rs_versions=$(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| rdi_versions=$(find content/integrate/redis-data-integration/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| redisvl_versions=$(find content/develop/ai/redisvl/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "kubernetes_versions=${kubernetes_versions}" >> $GITHUB_OUTPUT | |
| echo "rs_versions=${rs_versions}" >> $GITHUB_OUTPUT | |
| echo "rdi_versions=${rdi_versions}" >> $GITHUB_OUTPUT | |
| echo "redisvl_versions=${redisvl_versions}" >> $GITHUB_OUTPUT | |
| echo "Discovered versions:" | |
| echo " Kubernetes: ${kubernetes_versions}" | |
| echo " RS: ${rs_versions}" | |
| echo " RDI: ${rdi_versions}" | |
| echo " RedisVL: ${redisvl_versions}" | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Build latest (without versioned content) | |
| run: | | |
| set -x | |
| hugo_root_path="${{ steps.set-paths.outputs.hugo_root_path }}" | |
| sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/${hugo_root_path}\"#g" config.toml | |
| # Remove all versioned directories for the latest build | |
| kubernetes_versions='${{ steps.discover.outputs.kubernetes_versions }}' | |
| rs_versions='${{ steps.discover.outputs.rs_versions }}' | |
| rdi_versions='${{ steps.discover.outputs.rdi_versions }}' | |
| redisvl_versions='${{ steps.discover.outputs.redisvl_versions }}' | |
| for version in $(echo "$kubernetes_versions" | jq -r '.[]'); do | |
| rm -rf "content/operate/kubernetes/${version}" | |
| done | |
| for version in $(echo "$rs_versions" | jq -r '.[]'); do | |
| rm -rf "content/operate/rs/${version}" | |
| done | |
| for version in $(echo "$rdi_versions" | jq -r '.[]'); do | |
| rm -rf "content/integrate/redis-data-integration/${version}" | |
| done | |
| for version in $(echo "$redisvl_versions" | jq -r '.[]'); do | |
| rm -rf "content/develop/ai/redisvl/${version}" | |
| done | |
| # Create version files for docs-nav.html dropdowns | |
| echo "$kubernetes_versions" | jq -r '.[]' > kubernetes-versions | |
| echo "$rs_versions" | jq -r '.[]' > rs-versions | |
| echo "$rdi_versions" | jq -r '.[]' > rdi-versions | |
| echo "$redisvl_versions" | jq -r '.[]' > redisvl-versions | |
| make all | |
| - name: List client examples | |
| run: ls "${{ github.workspace }}/examples" | |
| - name: List files to be published | |
| run: ls "${{ github.workspace }}/public" | |
| - name: Upload latest artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-latest | |
| path: public/ | |
| retention-days: 1 | |
| # Build Kubernetes versions in parallel | |
| build_kubernetes: | |
| name: Build Kubernetes ${{ matrix.version }} | |
| needs: setup_and_build_latest | |
| if: ${{ needs.setup_and_build_latest.outputs.kubernetes_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.kubernetes_versions) }} | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| - name: Install Hugo | |
| run: | | |
| wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
| && sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
| - name: Check the branch out | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Generate components | |
| run: make components | |
| - name: Build Kubernetes ${{ matrix.version }} | |
| run: | | |
| set -x | |
| version="${{ matrix.version }}" | |
| hugo_root_path="${{ needs.setup_and_build_latest.outputs.hugo_root_path }}" | |
| sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/${hugo_root_path}\"#g" config.toml | |
| # Remove all other kubernetes versions | |
| kubernetes_versions='${{ needs.setup_and_build_latest.outputs.kubernetes_versions }}' | |
| for v in $(echo "$kubernetes_versions" | jq -r '.[]'); do | |
| if [[ "$v" != "$version" ]]; then | |
| rm -rf "content/operate/kubernetes/${v}" | |
| fi | |
| done | |
| # relrefs should not include version | |
| find "content/operate/kubernetes/${version}" -type f | while read file; do | |
| awk '{gsub(/\(\{\{< ?relref "\/operate\/kubernetes\/'"${version}"'/, "({{< relref \"/operate/kubernetes") }1' "$file" > tmpfile && mv tmpfile "$file" | |
| done | |
| rsync -a --delete-after "content/operate/kubernetes/${version}"/ content/operate/kubernetes/ | |
| sed -i 's/id="versionSelectorKubernetesValue" class="version-selector-control">latest/id="versionSelectorKubernetesValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html | |
| sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis for Kubernetes/' content/operate/kubernetes/_index.md | |
| # inject replace command in meta-links | |
| sed -i "12i \{\{ \$gh_path = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/${version}\/\" \$gh_path }}" layouts/partials/meta-links.html | |
| # Create version files for docs-nav.html dropdowns | |
| echo '${{ needs.setup_and_build_latest.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.redisvl_versions }}' | jq -r '.[]' > redisvl-versions | |
| hugo -d "output" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-kubernetes-${{ matrix.version }} | |
| path: output/ | |
| retention-days: 1 | |
| # Build RS versions in parallel | |
| build_rs: | |
| name: Build RS ${{ matrix.version }} | |
| needs: setup_and_build_latest | |
| if: ${{ needs.setup_and_build_latest.outputs.rs_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.rs_versions) }} | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| - name: Install Hugo | |
| run: | | |
| wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
| && sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
| - name: Check the branch out | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Generate components | |
| run: make components | |
| - name: Build RS ${{ matrix.version }} | |
| run: | | |
| set -x | |
| version="${{ matrix.version }}" | |
| hugo_root_path="${{ needs.setup_and_build_latest.outputs.hugo_root_path }}" | |
| sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/${hugo_root_path}\"#g" config.toml | |
| # Remove all other rs versions | |
| rs_versions='${{ needs.setup_and_build_latest.outputs.rs_versions }}' | |
| for v in $(echo "$rs_versions" | jq -r '.[]'); do | |
| if [[ "$v" != "$version" ]]; then | |
| rm -rf "content/operate/rs/${v}" | |
| fi | |
| done | |
| # relrefs should not include version | |
| find "content/operate/rs/${version}" -type f | while read file; do | |
| awk '{gsub(/\(\{\{< ?relref "\/operate\/rs\/'"${version}"'/, "({{< relref \"/operate/rs") }1' "$file" > tmpfile && mv tmpfile "$file" | |
| done | |
| rsync -a --delete-after "content/operate/rs/${version}"/ content/operate/rs/ | |
| sed -i 's/id="versionSelectorRsValue" class="version-selector-control">latest/id="versionSelectorRsValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html | |
| sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Software/' content/operate/rs/_index.md | |
| # inject replace command in meta-links | |
| sed -i "12i \{\{ \$gh_path = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/${version}\/\" \$gh_path }}" layouts/partials/meta-links.html | |
| # Create version files for docs-nav.html dropdowns | |
| echo '${{ needs.setup_and_build_latest.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.redisvl_versions }}' | jq -r '.[]' > redisvl-versions | |
| hugo -d "output" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-rs-${{ matrix.version }} | |
| path: output/ | |
| retention-days: 1 | |
| # Build RDI versions in parallel | |
| build_rdi: | |
| name: Build RDI ${{ matrix.version }} | |
| needs: setup_and_build_latest | |
| if: ${{ needs.setup_and_build_latest.outputs.rdi_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.rdi_versions) }} | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| - name: Install Hugo | |
| run: | | |
| wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
| && sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
| - name: Check the branch out | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Generate components | |
| run: make components | |
| - name: Build RDI ${{ matrix.version }} | |
| run: | | |
| set -x | |
| version="${{ matrix.version }}" | |
| hugo_root_path="${{ needs.setup_and_build_latest.outputs.hugo_root_path }}" | |
| sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/${hugo_root_path}\"#g" config.toml | |
| # Remove all other rdi versions | |
| rdi_versions='${{ needs.setup_and_build_latest.outputs.rdi_versions }}' | |
| for v in $(echo "$rdi_versions" | jq -r '.[]'); do | |
| if [[ "$v" != "$version" ]]; then | |
| rm -rf "content/integrate/redis-data-integration/${v}" | |
| fi | |
| done | |
| # relrefs should not include version | |
| find "content/integrate/redis-data-integration/${version}" -type f | while read file; do | |
| awk '{gsub(/\(\{\{< ?relref "\/integrate\/redis-data-integration\/'"${version}"'/, "({{< relref \"/integrate/redis-data-integration") }1' "$file" > tmpfile && mv tmpfile "$file" | |
| done | |
| rsync -a --delete-after "content/integrate/redis-data-integration/${version}"/ content/integrate/redis-data-integration/ | |
| sed -i 's/id="versionSelectorRedis-Data-IntegrationValue" class="version-selector-control">latest/id="versionSelectorRedis-Data-IntegrationValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html | |
| sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Data Integration/' content/integrate/redis-data-integration/_index.md | |
| # inject replace command in meta-links | |
| sed -i "12i \{\{ \$gh_path = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/${version}\/\" \$gh_path }}" layouts/partials/meta-links.html | |
| # Create version files for docs-nav.html dropdowns | |
| echo '${{ needs.setup_and_build_latest.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.redisvl_versions }}' | jq -r '.[]' > redisvl-versions | |
| hugo -d "output" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-rdi-${{ matrix.version }} | |
| path: output/ | |
| retention-days: 1 | |
| # Build RedisVL versions in parallel | |
| build_redisvl: | |
| name: Build RedisVL ${{ matrix.version }} | |
| needs: setup_and_build_latest | |
| if: ${{ needs.setup_and_build_latest.outputs.redisvl_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.redisvl_versions) }} | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| - name: Install Hugo | |
| run: | | |
| wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
| && sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
| - name: Check the branch out | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: make deps | |
| - name: Generate components | |
| run: make components | |
| - name: Build RedisVL ${{ matrix.version }} | |
| run: | | |
| set -x | |
| version="${{ matrix.version }}" | |
| hugo_root_path="${{ needs.setup_and_build_latest.outputs.hugo_root_path }}" | |
| sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/${hugo_root_path}\"#g" config.toml | |
| # Remove all other redisvl versions | |
| redisvl_versions='${{ needs.setup_and_build_latest.outputs.redisvl_versions }}' | |
| for v in $(echo "$redisvl_versions" | jq -r '.[]'); do | |
| if [[ "$v" != "$version" ]]; then | |
| rm -rf "content/develop/ai/redisvl/${v}" | |
| fi | |
| done | |
| # relrefs should not include version | |
| find "content/develop/ai/redisvl/${version}" -type f | while read file; do | |
| awk '{gsub(/\(\{\{< ?relref "\/develop\/ai\/redisvl\/'"${version}"'/, "({{< relref \"/develop/ai/redisvl") }1' "$file" > tmpfile && mv tmpfile "$file" | |
| done | |
| rsync -a --delete-after "content/develop/ai/redisvl/${version}"/ content/develop/ai/redisvl/ | |
| sed -i 's/id="versionSelectorRedisvlValue" class="version-selector-control">latest/id="versionSelectorRedisvlValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html | |
| sed -i 's/linkTitle: '"${version}"'/linkTitle: RedisVL/' content/develop/ai/redisvl/_index.md | |
| # inject replace command in meta-links | |
| sed -i "12i \{\{ \$gh_path = replaceRE \`\^develop\/ai\/redisvl\/\` \"develop\/ai\/redisvl\/${version}\/\" \$gh_path }}" layouts/partials/meta-links.html | |
| # Create version files for docs-nav.html dropdowns | |
| echo '${{ needs.setup_and_build_latest.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.setup_and_build_latest.outputs.redisvl_versions }}' | jq -r '.[]' > redisvl-versions | |
| hugo -d "output" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-redisvl-${{ matrix.version }} | |
| path: output/ | |
| retention-days: 1 | |
| # Deploy latest build to GCS | |
| deploy_latest: | |
| name: Deploy latest | |
| needs: setup_and_build_latest | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| env: | |
| PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }} | |
| PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }} | |
| PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }} | |
| steps: | |
| - name: Download latest artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-latest | |
| path: public/ | |
| - name: 'Google auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| service_account: '${{ env.PROD_SERVICE_ACCOUNT }}' | |
| workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}' | |
| - name: 'Set up Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| version: '>= 363.0.0' | |
| - name: Deploy latest to GCS | |
| run: | | |
| bucket_path="${{ needs.setup_and_build_latest.outputs.bucket_path }}" | |
| gsutil -m rsync -r -c -j html -d public gs://$BUCKET/$bucket_path | |
| gsutil -m rsync -r -c -j html -d public gs://$BUCKET/docs/$bucket_path | |
| # Deploy Kubernetes versions to GCS | |
| deploy_kubernetes: | |
| name: Deploy Kubernetes ${{ matrix.version }} | |
| needs: | |
| - setup_and_build_latest | |
| - build_kubernetes | |
| if: ${{ needs.setup_and_build_latest.outputs.kubernetes_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.kubernetes_versions) }} | |
| env: | |
| PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }} | |
| PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }} | |
| PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }} | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-kubernetes-${{ matrix.version }} | |
| path: output/ | |
| - name: 'Google auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| service_account: '${{ env.PROD_SERVICE_ACCOUNT }}' | |
| workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}' | |
| - name: 'Set up Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| version: '>= 363.0.0' | |
| - name: Deploy Kubernetes ${{ matrix.version }} to GCS | |
| run: | | |
| version="${{ matrix.version }}" | |
| bucket_path="${{ needs.setup_and_build_latest.outputs.bucket_path }}" | |
| if [[ "${{ github.ref_name }}" == "latest" ]]; then | |
| gsutil -m rsync -r -c -j html -d output/operate/kubernetes "gs://${BUCKET}/kubernetes-${version}/operate/kubernetes" | |
| gsutil -m rsync -r -c -j html -d "output/operate/kubernetes/${version}" "gs://${BUCKET}/docs/${bucket_path}/operate/kubernetes/${version}" | |
| elif [[ "$bucket_path" == staging/* ]]; then | |
| gsutil -m rsync -r -c -j html -d output/operate/kubernetes "gs://${BUCKET}/${bucket_path}/kubernetes-${version}/operate/kubernetes" | |
| gsutil -m rsync -r -c -j html -d "output/operate/kubernetes/${version}" "gs://${BUCKET}/docs/${bucket_path}/operate/kubernetes/${version}" | |
| fi | |
| # Deploy RS versions to GCS | |
| deploy_rs: | |
| name: Deploy RS ${{ matrix.version }} | |
| needs: | |
| - setup_and_build_latest | |
| - build_rs | |
| if: ${{ needs.setup_and_build_latest.outputs.rs_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.rs_versions) }} | |
| env: | |
| PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }} | |
| PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }} | |
| PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }} | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-rs-${{ matrix.version }} | |
| path: output/ | |
| - name: 'Google auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| service_account: '${{ env.PROD_SERVICE_ACCOUNT }}' | |
| workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}' | |
| - name: 'Set up Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| version: '>= 363.0.0' | |
| - name: Deploy RS ${{ matrix.version }} to GCS | |
| run: | | |
| version="${{ matrix.version }}" | |
| bucket_path="${{ needs.setup_and_build_latest.outputs.bucket_path }}" | |
| if [[ "${{ github.ref_name }}" == "latest" ]]; then | |
| gsutil -m rsync -r -c -j html -d output/operate/rs "gs://${BUCKET}/rs-${version}/operate/rs" | |
| gsutil -m rsync -r -c -j html -d "output/operate/rs/${version}" "gs://${BUCKET}/docs/${bucket_path}/operate/rs/${version}" | |
| elif [[ "$bucket_path" == staging/* ]]; then | |
| gsutil -m rsync -r -c -j html -d output/operate/rs "gs://${BUCKET}/${bucket_path}/rs-${version}/operate/rs" | |
| gsutil -m rsync -r -c -j html -d "output/operate/rs/${version}" "gs://${BUCKET}/docs/${bucket_path}/operate/rs/${version}" | |
| fi | |
| # Deploy RDI versions to GCS | |
| deploy_rdi: | |
| name: Deploy RDI ${{ matrix.version }} | |
| needs: | |
| - setup_and_build_latest | |
| - build_rdi | |
| if: ${{ needs.setup_and_build_latest.outputs.rdi_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.rdi_versions) }} | |
| env: | |
| PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }} | |
| PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }} | |
| PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }} | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-rdi-${{ matrix.version }} | |
| path: output/ | |
| - name: 'Google auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| service_account: '${{ env.PROD_SERVICE_ACCOUNT }}' | |
| workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}' | |
| - name: 'Set up Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| version: '>= 363.0.0' | |
| - name: Deploy RDI ${{ matrix.version }} to GCS | |
| run: | | |
| version="${{ matrix.version }}" | |
| bucket_path="${{ needs.setup_and_build_latest.outputs.bucket_path }}" | |
| if [[ "${{ github.ref_name }}" == "latest" ]]; then | |
| gsutil -m rsync -r -c -j html -d output/integrate/redis-data-integration "gs://${BUCKET}/redis-data-integration-${version}/integrate/redis-data-integration" | |
| gsutil -m rsync -r -c -j html -d "output/integrate/redis-data-integration/${version}" "gs://${BUCKET}/docs/${bucket_path}/integrate/redis-data-integration/${version}" | |
| elif [[ "$bucket_path" == staging/* ]]; then | |
| gsutil -m rsync -r -c -j html -d output/integrate/redis-data-integration "gs://${BUCKET}/${bucket_path}/redis-data-integration-${version}/integrate/redis-data-integration" | |
| gsutil -m rsync -r -c -j html -d "output/integrate/redis-data-integration/${version}" "gs://${BUCKET}/docs/${bucket_path}/integrate/redis-data-integration/${version}" | |
| fi | |
| # Deploy RedisVL versions to GCS | |
| deploy_redisvl: | |
| name: Deploy RedisVL ${{ matrix.version }} | |
| needs: | |
| - setup_and_build_latest | |
| - build_redisvl | |
| if: ${{ needs.setup_and_build_latest.outputs.redisvl_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.setup_and_build_latest.outputs.redisvl_versions) }} | |
| env: | |
| PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }} | |
| PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }} | |
| PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }} | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-redisvl-${{ matrix.version }} | |
| path: output/ | |
| - name: 'Google auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| service_account: '${{ env.PROD_SERVICE_ACCOUNT }}' | |
| workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}' | |
| - name: 'Set up Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| version: '>= 363.0.0' | |
| - name: Deploy RedisVL ${{ matrix.version }} to GCS | |
| run: | | |
| version="${{ matrix.version }}" | |
| bucket_path="${{ needs.setup_and_build_latest.outputs.bucket_path }}" | |
| if [[ "${{ github.ref_name }}" == "latest" ]]; then | |
| gsutil -m rsync -r -c -j html -d output/develop/ai/redisvl "gs://${BUCKET}/redisvl-${version}/develop/ai/redisvl" | |
| gsutil -m rsync -r -c -j html -d "output/develop/ai/redisvl/${version}" "gs://${BUCKET}/docs/${bucket_path}/develop/ai/redisvl/${version}" | |
| elif [[ "$bucket_path" == staging/* ]]; then | |
| gsutil -m rsync -r -c -j html -d output/develop/ai/redisvl "gs://${BUCKET}/${bucket_path}/redisvl-${version}/develop/ai/redisvl" | |
| gsutil -m rsync -r -c -j html -d "output/develop/ai/redisvl/${version}" "gs://${BUCKET}/docs/${bucket_path}/develop/ai/redisvl/${version}" | |
| fi | |
| # Deploy custom 404 page (only on latest branch) | |
| deploy_404: | |
| name: Deploy 404 page | |
| needs: setup_and_build_latest | |
| if: ${{ github.ref_name == 'latest' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| env: | |
| PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }} | |
| PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }} | |
| PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }} | |
| steps: | |
| - name: Download latest artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-latest | |
| path: public/ | |
| - name: Prepare 404 page | |
| run: | | |
| sed -i "s#/docs/latest/scss/#https://storage.googleapis.com/$BUCKET/docs/latest/scss/#g" public/404.html | |
| sed -i "s#/docs/latest/css/#https://storage.googleapis.com/$BUCKET/docs/latest/css/#g" public/404.html | |
| - name: 'Google auth' | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| service_account: '${{ env.PROD_SERVICE_ACCOUNT }}' | |
| workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}' | |
| - name: 'Set up Cloud SDK' | |
| uses: 'google-github-actions/setup-gcloud@v2' | |
| with: | |
| project_id: '${{ env.PROD_PROJECT_ID }}' | |
| version: '>= 363.0.0' | |
| - name: Deploy 404 page to GCS | |
| run: gsutil cp public/404.html gs://$BUCKET/docs/ |