|  | 
| 48 | 48 |             hugo_root_path=docs/staging/${{ github.ref_name }} | 
| 49 | 49 |           fi \ | 
| 50 | 50 |           && sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/$hugo_root_path\"#g" config.toml | 
| 51 |  | -    - name: Install dependencies and run Hugo | 
| 52 |  | -      run: make all | 
|  | 51 | +    - name: Install dependencies | 
|  | 52 | +      run: make deps | 
|  | 53 | + | 
|  | 54 | +    - name: Build out all versions | 
|  | 55 | +      run: | | 
|  | 56 | +        set -x | 
|  | 57 | +         | 
|  | 58 | +        kubernetes_versions=($(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}')) | 
|  | 59 | +        rs_versions=($(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}')) | 
|  | 60 | +
 | 
|  | 61 | +        # build latest | 
|  | 62 | +        for version in "${kubernetes_versions[@]}"; do | 
|  | 63 | +          rm -r "content/operate/kubernetes/${version}" | 
|  | 64 | +        done | 
|  | 65 | +        for version in "${rs_versions[@]}"; do | 
|  | 66 | +          rm -r "content/operate/rs/${version}" | 
|  | 67 | +        done | 
|  | 68 | +        make all | 
|  | 69 | +
 | 
|  | 70 | +        git checkout . | 
|  | 71 | +
 | 
|  | 72 | +        # build all versions | 
|  | 73 | +        for version in "${kubernetes_versions[@]}"; do | 
|  | 74 | +
 | 
|  | 75 | +          # for each version, remove all other versions before building | 
|  | 76 | +          versions_to_remove=($(echo "${kubernetes_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u)) | 
|  | 77 | +          for version_to_remove in "${versions_to_remove[@]}"; do | 
|  | 78 | +            rm -r "content/operate/kubernetes/${version_to_remove}" | 
|  | 79 | +          done | 
|  | 80 | +
 | 
|  | 81 | +          cp -r "content/operate/kubernetes/${version}"/* content/operate/kubernetes/ | 
|  | 82 | +          rm -r "content/operate/kubernetes/${version}" | 
|  | 83 | +          sed -i 's/id="versionSelectorKubernetesValue" class="version-selector-control">latest/id="versionSelectorKubernetesValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html | 
|  | 84 | +          sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis for Kubernetes/' content/operate/kubernetes/_index.md | 
|  | 85 | +
 | 
|  | 86 | +          # inject replace command in meta-links to make sure editURL and issuesURL point to right version | 
|  | 87 | +          sed -i "11i \{\{ \$gh_file = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html | 
|  | 88 | +
 | 
|  | 89 | +          hugo -d "kubernetes-${version}" | 
|  | 90 | +
 | 
|  | 91 | +          git checkout . | 
|  | 92 | +        done | 
|  | 93 | +
 | 
|  | 94 | +        for version in "${rs_versions[@]}"; do | 
|  | 95 | +
 | 
|  | 96 | +          # for each version, remove all other versions before building | 
|  | 97 | +          versions_to_remove=($(echo "${rs_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u)) | 
|  | 98 | +          for version_to_remove in "${versions_to_remove[@]}"; do | 
|  | 99 | +            rm -r "content/operate/rs/${version_to_remove}" | 
|  | 100 | +          done | 
|  | 101 | +
 | 
|  | 102 | +          cp -r "content/operate/rs/${version}"/* content/operate/rs/ | 
|  | 103 | +          rm -r "content/operate/rs/${version}" | 
|  | 104 | +          sed -i 's/id="versionSelectorRsValue" class="version-selector-control">latest/id="versionSelectorRsValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html | 
|  | 105 | +          sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Software/' content/operate/rs/_index.md | 
|  | 106 | +
 | 
|  | 107 | +          # inject replace command in meta-links to make sure editURL and issuesURL point to right version | 
|  | 108 | +          sed -i "11i \{\{ \$gh_file = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html | 
|  | 109 | +
 | 
|  | 110 | +          hugo -d "rs-${version}" | 
|  | 111 | +
 | 
|  | 112 | +          git checkout . | 
|  | 113 | +        done | 
|  | 114 | +
 | 
| 53 | 115 |     - name: List client examples | 
| 54 | 116 |       run: ls "${{ github.workspace }}/examples" | 
| 55 | 117 |     - name: List files to be published | 
| @@ -80,5 +142,12 @@ jobs: | 
| 80 | 142 |             bucket_path=staging/${{ github.ref_name }} | 
| 81 | 143 |           fi \ | 
| 82 | 144 |           && ./google-cloud-sdk/bin/gsutil -m rsync -r -c -j html -d ${{ github.workspace }}/public gs://$BUCKET/$bucket_path | 
|  | 145 | +
 | 
|  | 146 | +          versioned_builds=($(find . -type d -regex ".*[0-9-]" -maxdepth 1 | sed -E 's/^.\///')) | 
|  | 147 | +          for versioned_build in "${versioned_builds[@]}"; do | 
|  | 148 | +            product=$(grep -Eo '[a-zA-Z]+' <<< $versioned_build) | 
|  | 149 | +            gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}" | 
|  | 150 | +          done | 
|  | 151 | +
 | 
| 83 | 152 |     - name: End | 
| 84 | 153 |       run: echo "This job's status is ${{ job.status }}." | 
0 commit comments