Skip to content

Commit d107f91

Browse files
resolve merge conflict
2 parents 4aa688d + 4e1787d commit d107f91

File tree

771 files changed

+58478
-3621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

771 files changed

+58478
-3621
lines changed

.github/workflows/autocomment.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ jobs:
5151
$FILES_URL \
5252
| jq -r --arg prefix $BRANCH_NAME/ '.[] | select(((.filename | test("content\/.+\\.md")) and .status != "removed")) | ($prefix + .filename)' \
5353
| sed -E -e 's|(^[^/]+/)([^/]+/)|\1|' -e 's|^|https://redis.io/docs/staging/|' -e 's|(_?index)?\.md||' \
54-
| uniq \
55-
| xargs \
56-
| sed 's/ /<br>/g')
54+
| sort \
55+
| uniq)
5756
5857
# Get all changed image files
5958
CHANGED_IMAGE_FILES=$(curl -Ls \
@@ -70,14 +69,19 @@ jobs:
7069
for CHANGED_IMAGE_FILE in $CHANGED_IMAGE_FILES; do
7170
MD_FILE_WITH_IMAGE=$(grep -ro "$CHANGED_IMAGE_FILE" content \
7271
| sed -E -e 's|:.+||' -e "s|^content/|https://redis.io/docs/staging/$BRANCH_NAME/|" -e 's|(_?index)?\.md||' \
72+
| sort \
7373
| uniq)
7474
MD_FILES_WITH_IMAGE+=($MD_FILE_WITH_IMAGE)
7575
done
76-
CHANGED_MD_FILES_WITH_IMAGE=$(printf "%s\n" "${MD_FILES_WITH_IMAGE[@]}" \
76+
CHANGED_MD_FILES=$(printf "%s\n" "${CHANGED_MD_FILES}" "${MD_FILES_WITH_IMAGE[@]}" \
77+
| sort \
7778
| uniq \
7879
| xargs \
7980
| sed 's/ /<br>/g')
80-
CHANGED_MD_FILES="${CHANGED_MD_FILES}<br>${CHANGED_MD_FILES_WITH_IMAGE}"
81+
else
82+
CHANGED_MD_FILES=$(printf "%s\n" "${CHANGED_MD_FILES}" \
83+
| xargs \
84+
| sed 's/ /<br>/g')
8185
fi
8286
8387
if [[ -z "$CHANGED_MD_FILES" ]]
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: cleanup_pr_folders
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
staging:
10+
if: github.event.pull_request.merged == true
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: 'read'
14+
id-token: 'write'
15+
env:
16+
STAGING_BUCKET: docs-staging-learn-redis-com
17+
STAGING_PROJECT_ID: ${{ secrets.GCP_PROJECT_STAGING }}
18+
STAGING_SERVICE_ACCOUNT: ${{ secrets.STAGING_SERVICE_ACCOUNT }}
19+
STAGING_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.STAGING_WORKLOAD_IDENTITY_PROVIDER }}
20+
21+
steps:
22+
- name: 'Google auth'
23+
uses: 'google-github-actions/auth@v2'
24+
with:
25+
project_id: '${{ env.STAGING_PROJECT_ID }}'
26+
service_account: '${{ env.STAGING_SERVICE_ACCOUNT }}'
27+
workload_identity_provider: '${{ env.STAGING_WORKLOAD_IDENTITY_PROVIDER }}'
28+
29+
- name: 'Set up Cloud SDK'
30+
uses: 'google-github-actions/setup-gcloud@v2'
31+
with:
32+
project_id: '${{ env.STAGING_PROJECT_ID }}'
33+
version: '>= 363.0.0'
34+
35+
- name: Remove pull request staging folder
36+
run: |
37+
BRANCH_TO_CLEANUP="${{ github.event.pull_request.head.ref }}"
38+
STAGING_BUCKET="${{ env.STAGING_BUCKET }}"
39+
40+
if gsutil -q stat gs://${STAGING_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*; then
41+
gsutil -q -m rm -r gs://${STAGING_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*
42+
echo "Removed gs://${STAGING_BUCKET}/staging/${BRANCH_TO_CLEANUP}"
43+
fi
44+
45+
prod:
46+
if: github.event.pull_request.merged == true
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: 'read'
50+
id-token: 'write'
51+
env:
52+
PROD_BUCKET: docs-prod-learn-redis-com
53+
PROD_PROJECT_ID: ${{ secrets.GCP_PROJECT_PROD }}
54+
PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }}
55+
PROD_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.PROD_WORKLOAD_IDENTITY_PROVIDER }}
56+
57+
steps:
58+
- name: 'Google auth'
59+
uses: 'google-github-actions/auth@v2'
60+
with:
61+
project_id: '${{ env.PROD_PROJECT_ID }}'
62+
service_account: '${{ env.PROD_SERVICE_ACCOUNT }}'
63+
workload_identity_provider: '${{ env.PROD_WORKLOAD_IDENTITY_PROVIDER }}'
64+
65+
- name: 'Set up Cloud SDK'
66+
uses: 'google-github-actions/setup-gcloud@v2'
67+
with:
68+
project_id: '${{ env.PROD_PROJECT_ID }}'
69+
version: '>= 363.0.0'
70+
71+
- name: Remove pull request staging folder
72+
run: |
73+
BRANCH_TO_CLEANUP="${{ github.event.pull_request.head.ref }}"
74+
PROD_BUCKET="${{ env.PROD_BUCKET }}"
75+
76+
if gsutil -q stat gs://${PROD_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*; then
77+
gsutil -q -m rm -r gs://${PROD_BUCKET}/staging/${BRANCH_TO_CLEANUP}/*
78+
echo "Removed gs://${PROD_BUCKET}/staging/${BRANCH_TO_CLEANUP}"
79+
fi

.github/workflows/main-staging.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ jobs:
8787
rm -r "content/operate/kubernetes/${version_to_remove}"
8888
done
8989
90-
cp -r "content/operate/kubernetes/${version}"/* content/operate/kubernetes/
91-
rm -r "content/operate/kubernetes/${version}"
90+
# relrefs should not include version
91+
find "content/operate/kubernetes/${version}" -type f | while read file; do
92+
awk '{gsub(/\(\{\{< ?relref "\/operate\/kubernetes\/'${version}'/, "({{< relref \"/operate/kubernetes") }1' "$file" > tmpfile && mv tmpfile "$file"
93+
done
94+
95+
rsync -a --delete-after "content/operate/kubernetes/${version}"/ content/operate/kubernetes/
9296
sed -i 's/id="versionSelectorKubernetesValue" class="version-selector-control">latest/id="versionSelectorKubernetesValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
9397
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis for Kubernetes/' content/operate/kubernetes/_index.md
9498
9599
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
96-
sed -i "12i \{\{ \$gh_file = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
100+
sed -i "12i \{\{ \$gh_path = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_path }}" layouts/partials/meta-links.html
97101
98102
hugo -d "kubernetes-${version}"
99103
@@ -110,13 +114,17 @@ jobs:
110114
rm -r "content/operate/rs/${version_to_remove}"
111115
done
112116
113-
cp -r "content/operate/rs/${version}"/* content/operate/rs/
114-
rm -r "content/operate/rs/${version}"
117+
# relrefs should not include version
118+
find "content/operate/rs/${version}" -type f | while read file; do
119+
awk '{gsub(/\(\{\{< ?relref "\/operate\/rs\/'${version}'/, "({{< relref \"/operate/rs") }1' "$file" > tmpfile && mv tmpfile "$file"
120+
done
121+
122+
rsync -a --delete-after "content/operate/rs/${version}"/ content/operate/rs/
115123
sed -i 's/id="versionSelectorRsValue" class="version-selector-control">latest/id="versionSelectorRsValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
116124
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Software/' content/operate/rs/_index.md
117125
118126
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
119-
sed -i "12i \{\{ \$gh_file = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
127+
sed -i "12i \{\{ \$gh_path = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_path }}" layouts/partials/meta-links.html
120128
121129
hugo -d "rs-${version}"
122130
@@ -133,13 +141,17 @@ jobs:
133141
rm -r "content/integrate/redis-data-integration/${version_to_remove}"
134142
done
135143
136-
cp -r "content/integrate/redis-data-integration/${version}"/* content/integrate/redis-data-integration/
137-
rm -r "content/integrate/redis-data-integration/${version}"
144+
# relrefs should not include version
145+
find "content/operate/redis-data-integration/${version}" -type f | while read file; do
146+
awk '{gsub(/\(\{\{< ?relref "\/operate\/redis-data-integration\/'${version}'/, "({{< relref \"/operate/redis-data-integration") }1' "$file" > tmpfile && mv tmpfile "$file"
147+
done
148+
149+
rsync -a --delete-after "content/operate/redis-data-integration/${version}"/ content/operate/redis-data-integration/
138150
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
139151
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Data Integration/' content/integrate/redis-data-integration/_index.md
140152
141153
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
142-
sed -i "12i \{\{ \$gh_file = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
154+
sed -i "12i \{\{ \$gh_path = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/$version\/\" \$gh_path }}" layouts/partials/meta-links.html
143155
144156
hugo -d "redis-data-integration-${version}"
145157
@@ -181,9 +193,9 @@ jobs:
181193
for versioned_build in "${versioned_builds[@]}"; do
182194
product=$(awk 'BEGIN{FS=OFS="-"}{NF--; print}' <<< $versioned_build)
183195
if [[ "${product}" == "redis-data-integration" ]]; then
184-
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/integrate/${product}" "gs://${BUCKET}/${versioned_build}/integrate/${product}"
196+
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/integrate/${product}/" "gs://${BUCKET}/${bucket_path}/${versioned_build}/integrate/${product}"
185197
else
186-
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
198+
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}/" "gs://${BUCKET}/${bucket_path}/${versioned_build}/operate/${product}"
187199
fi
188200
done
189201

.github/workflows/main.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ jobs:
8787
rm -r "content/operate/kubernetes/${version_to_remove}"
8888
done
8989
90-
cp -r "content/operate/kubernetes/${version}"/* content/operate/kubernetes/
91-
rm -r "content/operate/kubernetes/${version}"
90+
# relrefs should not include version
91+
find "content/operate/kubernetes/${version}" -type f | while read file; do
92+
awk '{gsub(/\(\{\{< ?relref "\/operate\/kubernetes\/'${version}'/, "({{< relref \"/operate/kubernetes") }1' "$file" > tmpfile && mv tmpfile "$file"
93+
done
94+
95+
rsync -a --delete-after "content/operate/kubernetes/${version}"/ content/operate/kubernetes/
9296
sed -i 's/id="versionSelectorKubernetesValue" class="version-selector-control">latest/id="versionSelectorKubernetesValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
9397
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis for Kubernetes/' content/operate/kubernetes/_index.md
9498
9599
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
96-
sed -i "12i \{\{ \$gh_file = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
100+
sed -i "12i \{\{ \$gh_path = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_path }}" layouts/partials/meta-links.html
97101
98102
hugo -d "kubernetes-${version}"
99103
@@ -110,13 +114,17 @@ jobs:
110114
rm -r "content/operate/rs/${version_to_remove}"
111115
done
112116
113-
cp -r "content/operate/rs/${version}"/* content/operate/rs/
114-
rm -r "content/operate/rs/${version}"
117+
# relrefs should not include version
118+
find "content/operate/rs/${version}" -type f | while read file; do
119+
awk '{gsub(/\(\{\{< ?relref "\/operate\/rs\/'${version}'/, "({{< relref \"/operate/rs") }1' "$file" > tmpfile && mv tmpfile "$file"
120+
done
121+
122+
rsync -a --delete-after "content/operate/rs/${version}"/ content/operate/rs/
115123
sed -i 's/id="versionSelectorRsValue" class="version-selector-control">latest/id="versionSelectorRsValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
116124
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Software/' content/operate/rs/_index.md
117125
118126
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
119-
sed -i "12i \{\{ \$gh_file = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
127+
sed -i "12i \{\{ \$gh_path = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_path }}" layouts/partials/meta-links.html
120128
121129
hugo -d "rs-${version}"
122130
@@ -133,13 +141,17 @@ jobs:
133141
rm -r "content/integrate/redis-data-integration/${version_to_remove}"
134142
done
135143
136-
cp -r "content/integrate/redis-data-integration/${version}"/* content/integrate/redis-data-integration/
137-
rm -r "content/integrate/redis-data-integration/${version}"
144+
# relrefs should not include version
145+
find "content/operate/redis-data-integration/${version}" -type f | while read file; do
146+
awk '{gsub(/\(\{\{< ?relref "\/operate\/redis-data-integration\/'${version}'/, "({{< relref \"/operate/redis-data-integration") }1' "$file" > tmpfile && mv tmpfile "$file"
147+
done
148+
149+
rsync -a --delete-after "content/operate/redis-data-integration/${version}"/ content/operate/redis-data-integration/
138150
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
139151
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Data Integration/' content/integrate/redis-data-integration/_index.md
140152
141153
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
142-
sed -i "12i \{\{ \$gh_file = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
154+
sed -i "12i \{\{ \$gh_path = replaceRE \`\^integrate\/redis-data-integration\/\` \"integrate\/redis-data-integration\/$version\/\" \$gh_path }}" layouts/partials/meta-links.html
143155
144156
hugo -d "redis-data-integration-${version}"
145157

0 commit comments

Comments
 (0)