Update RDI version number in config #12765
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 compute deployment paths. This job is intentionally | |
| # lightweight (checkout only) so the versioned matrix builds can start | |
| # without waiting for the full latest build. | |
| discover_versions: | |
| name: Discover versions | |
| 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: 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: Check the branch out | |
| uses: actions/checkout@v4 | |
| - name: Set paths | |
| id: set-paths | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "main" ]]; then | |
| # main is the production branch: merges publish straight to /latest. | |
| 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}" | |
| # Build the latest docs | |
| setup_and_build_latest: | |
| name: Setup and build latest docs | |
| needs: discover_versions | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| steps: | |
| - 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: Build latest (without versioned content) | |
| run: | | |
| set -x | |
| hugo_root_path="${{ needs.discover_versions.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='${{ needs.discover_versions.outputs.kubernetes_versions }}' | |
| rs_versions='${{ needs.discover_versions.outputs.rs_versions }}' | |
| rdi_versions='${{ needs.discover_versions.outputs.rdi_versions }}' | |
| redisvl_versions='${{ needs.discover_versions.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 ci` skips `clean` (the CI workspace is a fresh checkout, and | |
| # `clean` would delete the node_modules that `make deps` just installed). | |
| make ci | |
| - 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: discover_versions | |
| if: ${{ needs.discover_versions.outputs.kubernetes_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.outputs.kubernetes_versions) }} | |
| steps: | |
| - 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.discover_versions.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.discover_versions.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.discover_versions.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.discover_versions.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.discover_versions.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.discover_versions.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: discover_versions | |
| if: ${{ needs.discover_versions.outputs.rs_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.outputs.rs_versions) }} | |
| steps: | |
| - 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.discover_versions.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.discover_versions.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.discover_versions.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.discover_versions.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.discover_versions.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.discover_versions.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: discover_versions | |
| if: ${{ needs.discover_versions.outputs.rdi_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.outputs.rdi_versions) }} | |
| steps: | |
| - 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.discover_versions.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.discover_versions.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.discover_versions.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.discover_versions.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.discover_versions.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.discover_versions.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: discover_versions | |
| if: ${{ needs.discover_versions.outputs.redisvl_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.outputs.redisvl_versions) }} | |
| steps: | |
| - 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.discover_versions.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.discover_versions.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.discover_versions.outputs.kubernetes_versions }}' | jq -r '.[]' > kubernetes-versions | |
| echo '${{ needs.discover_versions.outputs.rs_versions }}' | jq -r '.[]' > rs-versions | |
| echo '${{ needs.discover_versions.outputs.rdi_versions }}' | jq -r '.[]' > rdi-versions | |
| echo '${{ needs.discover_versions.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: | |
| - discover_versions | |
| - 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.discover_versions.outputs.bucket_path }}" | |
| # The -d flag mirrors the bucket to this build, deleting any object not | |
| # present locally -- including older fingerprinted css/index.min.{hash}.css | |
| # files. Browser/Cloudflare-cached HTML can still reference an old hash for | |
| # hours after a deploy, so deleting it produces 404s. Exclude css/scss from | |
| # the destructive syncs, then additively upload this build's css/scss (no -d) | |
| # so old and new hashes coexist. Mirrors the versioned matrix deploy jobs. | |
| upload_assets() { | |
| local dest="$1" | |
| for d in css scss; do | |
| if [ -d "public/$d" ]; then | |
| gsutil -m rsync -r -c -j css "public/$d" "${dest}/$d" | |
| fi | |
| done | |
| } | |
| # The two destinations are independent, so run their sync pipelines | |
| # concurrently. Within each destination the destructive sync still runs | |
| # before the additive css/scss upload. | |
| sync_dest() { | |
| local dest="$1" | |
| gsutil -m rsync -r -c -j html -d -x '^(css|scss)/' public "$dest" | |
| upload_assets "$dest" | |
| } | |
| sync_dest "gs://$BUCKET/$bucket_path" & | |
| pid_root=$! | |
| sync_dest "gs://$BUCKET/docs/$bucket_path" & | |
| pid_docs=$! | |
| # Propagate failures: either sync failing fails the step. | |
| wait "$pid_root" | |
| wait "$pid_docs" | |
| # Deploy Kubernetes versions to GCS | |
| deploy_kubernetes: | |
| name: Deploy Kubernetes ${{ matrix.version }} | |
| needs: | |
| - discover_versions | |
| - setup_and_build_latest | |
| - build_kubernetes | |
| # deploy_latest mirrors public -> docs/<path> with `-d`, which deletes any | |
| # versioned subdir present at mirror time. Gate the versioned deploy on it | |
| # so the destructive latest sync always completes before we write versioned | |
| # content into the same tree. | |
| - deploy_latest | |
| if: ${{ needs.discover_versions.outputs.kubernetes_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.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.discover_versions.outputs.bucket_path }}" | |
| # Matrix Hugo builds can produce different CSS hashes than deploy_latest, | |
| # so versioned pages 404 on /css/index.min.{hash}.css. Additively rsync | |
| # this build's css/scss (no -d) so each hash coexists alongside the | |
| # canonical hash uploaded by deploy_latest. Applied on both latest and | |
| # staging. | |
| upload_assets() { | |
| local dest="$1" | |
| for d in css scss; do | |
| if [ -d "output/$d" ]; then | |
| gsutil -m rsync -r -c -j css "output/$d" "${dest}/$d" | |
| fi | |
| done | |
| } | |
| if [[ "$bucket_path" == "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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| 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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| fi | |
| # Deploy RS versions to GCS | |
| deploy_rs: | |
| name: Deploy RS ${{ matrix.version }} | |
| needs: | |
| - discover_versions | |
| - setup_and_build_latest | |
| - build_rs | |
| # See deploy_kubernetes: gate on deploy_latest so its destructive mirror | |
| # runs before versioned content is written into the same tree. | |
| - deploy_latest | |
| if: ${{ needs.discover_versions.outputs.rs_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.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.discover_versions.outputs.bucket_path }}" | |
| upload_assets() { | |
| local dest="$1" | |
| for d in css scss; do | |
| if [ -d "output/$d" ]; then | |
| gsutil -m rsync -r -c -j css "output/$d" "${dest}/$d" | |
| fi | |
| done | |
| } | |
| if [[ "$bucket_path" == "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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| 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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| fi | |
| # Deploy RDI versions to GCS | |
| deploy_rdi: | |
| name: Deploy RDI ${{ matrix.version }} | |
| needs: | |
| - discover_versions | |
| - setup_and_build_latest | |
| - build_rdi | |
| # See deploy_kubernetes: gate on deploy_latest so its destructive mirror | |
| # runs before versioned content is written into the same tree. | |
| - deploy_latest | |
| if: ${{ needs.discover_versions.outputs.rdi_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.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.discover_versions.outputs.bucket_path }}" | |
| upload_assets() { | |
| local dest="$1" | |
| for d in css scss; do | |
| if [ -d "output/$d" ]; then | |
| gsutil -m rsync -r -c -j css "output/$d" "${dest}/$d" | |
| fi | |
| done | |
| } | |
| if [[ "$bucket_path" == "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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| 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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| fi | |
| # Deploy RedisVL versions to GCS | |
| deploy_redisvl: | |
| name: Deploy RedisVL ${{ matrix.version }} | |
| needs: | |
| - discover_versions | |
| - setup_and_build_latest | |
| - build_redisvl | |
| # See deploy_kubernetes: gate on deploy_latest so its destructive mirror | |
| # runs before versioned content is written into the same tree. | |
| - deploy_latest | |
| if: ${{ needs.discover_versions.outputs.redisvl_versions != '[]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJson(needs.discover_versions.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.discover_versions.outputs.bucket_path }}" | |
| upload_assets() { | |
| local dest="$1" | |
| for d in css scss; do | |
| if [ -d "output/$d" ]; then | |
| gsutil -m rsync -r -c -j css "output/$d" "${dest}/$d" | |
| fi | |
| done | |
| } | |
| if [[ "$bucket_path" == "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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| 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}" | |
| upload_assets "gs://${BUCKET}/docs/${bucket_path}" | |
| fi | |
| # Deploy custom 404 page (only for the production latest build) | |
| deploy_404: | |
| name: Deploy 404 page | |
| needs: | |
| - discover_versions | |
| - setup_and_build_latest | |
| if: ${{ needs.discover_versions.outputs.bucket_path == '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/ |