Skip to content

Commit

Permalink
Update workflows to support rdi versioning (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloredis authored Feb 20, 2025
1 parent 5d00f15 commit 345a5a3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
35 changes: 33 additions & 2 deletions .github/workflows/main-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
setBaseUrl
kubernetes_versions=($(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
rs_versions=($(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
rdi_versions=($(find content/integrate/redis-data-integration/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
# build latest
for version in "${kubernetes_versions[@]}"; do
Expand All @@ -68,6 +69,9 @@ jobs:
for version in "${rs_versions[@]}"; do
rm -r "content/operate/rs/${version}"
done
for version in "${rdi_versions[@]}"; do
rm -r "content/integrate/redis-data-integration/${version}"
done
make all
git checkout .
Expand Down Expand Up @@ -119,6 +123,29 @@ jobs:
git checkout .
done
for version in "${rdi_versions[@]}"; do
setBaseUrl
# for each version, remove all other versions before building
versions_to_remove=($(echo "${rdi_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
for version_to_remove in "${versions_to_remove[@]}"; do
rm -r "content/integrate/redis-data-integration/${version_to_remove}"
done
cp -r "content/integrate/redis-data-integration/${version}"/* content/integrate/redis-data-integration/
rm -r "content/integrate/redis-data-integration/${version}"
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 to make sure editURL and issuesURL point to right version
sed -i "12i \{\{ \$gh_file = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
hugo -d "redis-data-integration-${version}"
git checkout .
done
- name: List client examples
run: ls "${{ github.workspace }}/examples"
- name: List files to be published
Expand Down Expand Up @@ -152,8 +179,12 @@ jobs:
versioned_builds=($(find . -type d -regex ".*[0-9-]" -maxdepth 1 | sed -E 's/^.\///'))
for versioned_build in "${versioned_builds[@]}"; do
product=$(grep -Eo '[a-zA-Z]+' <<< $versioned_build)
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
product=$(awk 'BEGIN{FS=OFS="-"}{NF--; print}' <<< $versioned_build)
if [[ "${product}" == "redis-data-integration" ]]; then
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/integrate/${product}" "gs://${BUCKET}/${versioned_build}/integrate/${product}"
else
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
fi
done
- name: End
Expand Down
43 changes: 39 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
setBaseUrl
kubernetes_versions=($(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
rs_versions=($(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
rdi_versions=($(find content/integrate/redis-data-integration/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
# build latest
for version in "${kubernetes_versions[@]}"; do
Expand All @@ -68,6 +69,9 @@ jobs:
for version in "${rs_versions[@]}"; do
rm -r "content/operate/rs/${version}"
done
for version in "${rdi_versions[@]}"; do
rm -r "content/integrate/redis-data-integration/${version}"
done
make all
git checkout .
Expand Down Expand Up @@ -119,6 +123,29 @@ jobs:
git checkout .
done
for version in "${rdi_versions[@]}"; do
setBaseUrl
# for each version, remove all other versions before building
versions_to_remove=($(echo "${rdi_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
for version_to_remove in "${versions_to_remove[@]}"; do
rm -r "content/integrate/redis-data-integration/${version_to_remove}"
done
cp -r "content/integrate/redis-data-integration/${version}"/* content/integrate/redis-data-integration/
rm -r "content/integrate/redis-data-integration/${version}"
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 to make sure editURL and issuesURL point to right version
sed -i "12i \{\{ \$gh_file = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
hugo -d "redis-data-integration-${version}"
git checkout .
done
- name: List client examples
run: ls "${{ github.workspace }}/examples"
- name: List files to be published
Expand Down Expand Up @@ -154,17 +181,25 @@ jobs:
then
versioned_builds=($(find . -type d -regex ".*[0-9-]" -maxdepth 1 | sed -E 's/^.\///'))
for versioned_build in "${versioned_builds[@]}"; do
product=$(grep -Eo '[a-zA-Z]+' <<< $versioned_build)
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
product=$(awk 'BEGIN{FS=OFS="-"}{NF--; print}' <<< $versioned_build)
if [[ "${product}" == "redis-data-integration" ]]; then
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/integrate/${product}" "gs://${BUCKET}/${versioned_build}/integrate/${product}"
else
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
fi
done
fi
if [[ "$bucket_path" == staging/* ]]
then
versioned_builds=($(find . -type d -regex ".*[0-9-]" -maxdepth 1 | sed -E 's/^.\///'))
for versioned_build in "${versioned_builds[@]}"; do
product=$(grep -Eo '[a-zA-Z]+' <<< $versioned_build)
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${bucket_path}/${versioned_build}/operate/${product}"
product=$(awk 'BEGIN{FS=OFS="-"}{NF--; print}' <<< $versioned_build)
if [[ "${product}" == "redis-data-integration" ]]; then
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/integrate/${product}" "gs://${BUCKET}/${bucket_path}/${versioned_build}/integrate/${product}"
else
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${bucket_path}/${versioned_build}/operate/${product}"
fi
done
fi
Expand Down

0 comments on commit 345a5a3

Please sign in to comment.