Skip to content

Commit b46361c

Browse files
committed
Merge branch 'release-rs-fuya-fuya' into DOC-4280
2 parents ec77642 + 538c4ec commit b46361c

File tree

248 files changed

+12922
-1652
lines changed

Some content is hidden

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

248 files changed

+12922
-1652
lines changed

.github/workflows/main.yml

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,92 @@ jobs:
3333
echo "ERROR: Invalid branch name ${{ github.ref_name }}!"
3434
exit 1
3535
fi
36-
- name: Configure Hugo
36+
37+
- name: Install dependencies
38+
run: make deps
39+
40+
- name: Build out all versions
3741
run: |
42+
set -x
43+
44+
function setBaseUrl() {
3845
if [[ "${{ github.ref_name }}" == "main" ]]
3946
then
4047
hugo_root_path=docs/staging/dev
4148
elif [[ "${{ github.ref_name }}" == "latest" ]]
4249
then
43-
hugo_root_path="docs/latest"
50+
hugo_root_path="docs/latest"
4451
elif [[ "${{ endsWith(github.ref_name, '-build') }}" == "true" ]]
4552
then
4653
hugo_root_path=`echo docs/version/${{ github.ref_name }} | sed 's/-build$//'`
4754
else
4855
hugo_root_path=docs/staging/${{ github.ref_name }}
4956
fi \
5057
&& 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
58+
}
59+
60+
setBaseUrl
61+
kubernetes_versions=($(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
62+
rs_versions=($(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
63+
64+
# build latest
65+
for version in "${kubernetes_versions[@]}"; do
66+
rm -r "content/operate/kubernetes/${version}"
67+
done
68+
for version in "${rs_versions[@]}"; do
69+
rm -r "content/operate/rs/${version}"
70+
done
71+
make all
72+
73+
git checkout .
74+
75+
# build all versions
76+
for version in "${kubernetes_versions[@]}"; do
77+
78+
setBaseUrl
79+
80+
# for each version, remove all other versions before building
81+
versions_to_remove=($(echo "${kubernetes_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
82+
for version_to_remove in "${versions_to_remove[@]}"; do
83+
rm -r "content/operate/kubernetes/${version_to_remove}"
84+
done
85+
86+
cp -r "content/operate/kubernetes/${version}"/* content/operate/kubernetes/
87+
rm -r "content/operate/kubernetes/${version}"
88+
sed -i 's/id="versionSelectorKubernetesValue" class="version-selector-control">latest/id="versionSelectorKubernetesValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
89+
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis for Kubernetes/' content/operate/kubernetes/_index.md
90+
91+
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
92+
sed -i "11i \{\{ \$gh_file = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
93+
94+
hugo -d "kubernetes-${version}"
95+
96+
git checkout .
97+
done
98+
99+
for version in "${rs_versions[@]}"; do
100+
101+
setBaseUrl
102+
103+
# for each version, remove all other versions before building
104+
versions_to_remove=($(echo "${rs_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
105+
for version_to_remove in "${versions_to_remove[@]}"; do
106+
rm -r "content/operate/rs/${version_to_remove}"
107+
done
108+
109+
cp -r "content/operate/rs/${version}"/* content/operate/rs/
110+
rm -r "content/operate/rs/${version}"
111+
sed -i 's/id="versionSelectorRsValue" class="version-selector-control">latest/id="versionSelectorRsValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
112+
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Software/' content/operate/rs/_index.md
113+
114+
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
115+
sed -i "11i \{\{ \$gh_file = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
116+
117+
hugo -d "rs-${version}"
118+
119+
git checkout .
120+
done
121+
53122
- name: List client examples
54123
run: ls "${{ github.workspace }}/examples"
55124
- name: List files to be published
@@ -80,5 +149,12 @@ jobs:
80149
bucket_path=staging/${{ github.ref_name }}
81150
fi \
82151
&& ./google-cloud-sdk/bin/gsutil -m rsync -r -c -j html -d ${{ github.workspace }}/public gs://$BUCKET/$bucket_path
152+
153+
versioned_builds=($(find . -type d -regex ".*[0-9-]" -maxdepth 1 | sed -E 's/^.\///'))
154+
for versioned_build in "${versioned_builds[@]}"; do
155+
product=$(grep -Eo '[a-zA-Z]+' <<< $versioned_build)
156+
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
157+
done
158+
83159
- name: End
84160
run: echo "This job's status is ${{ job.status }}."
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: redis_modules_docs_sync
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # run every day at midnight UTC time
6+
workflow_dispatch: # or run on manual trigger
7+
8+
jobs:
9+
redis_modules_docs_sync:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
actions: write
15+
steps:
16+
- name: 'Checkout'
17+
uses: 'actions/checkout@v3'
18+
19+
- name: 'Fetch commands json files from modules'
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: |
23+
branch="redis_modules_docs_sync"
24+
modules_list=("redisjson" "redisbloom" "redistimeseries" "redisearch")
25+
module_change=false
26+
27+
# check if remote branch already exists
28+
git fetch --all
29+
set +e
30+
git ls-remote --exit-code --heads origin "refs/heads/${branch}"
31+
if [ "$?" -eq 0 ]; then
32+
set -e
33+
# if it does, create local branch off existing remote branch
34+
git checkout -b "${branch}" "origin/${branch}"
35+
git branch --set-upstream-to="origin/${branch}" "${branch}"
36+
git pull
37+
else
38+
set -e
39+
# otherwise, create local branch from main
40+
git checkout -b "${branch}"
41+
fi
42+
43+
for module in "${modules_list[@]}"; do
44+
# Find latest version
45+
module_version=$(
46+
curl -Ls \
47+
-H "Accept: application/vnd.github+json" \
48+
-H "Authorization: Bearer ${GH_TOKEN}" \
49+
-H "X-GitHub-Api-Version: 2022-11-28" \
50+
"https://api.github.com/repos/${module}/${module}/releases/latest" \
51+
| jq -r '.tag_name'
52+
)
53+
54+
# Fetch release
55+
gh release download "$module_version" -R "${module}/${module}" -A zip -O "${module}.zip"
56+
unzip "${module}.zip" -d "${module}"
57+
cp ${module}/*/commands.json "data/commands_${module}.json"
58+
59+
modules_commands_is_different=$(git diff "data/commands_${module}.json")
60+
if [[ ! -z $modules_commands_is_different ]]; then
61+
module_change=true
62+
63+
git add "data/commands_${module}.json"
64+
git config user.email "177626021+redisdocsapp[bot]@users.noreply.github.com"
65+
git config user.name "redisdocsapp[bot]"
66+
git commit -m "Update data/commands_${module}.json for release ${module_version}"
67+
fi
68+
done
69+
70+
if [ "$module_change" = true ] ; then
71+
git push origin "${branch}"
72+
73+
# If a pr is not already open, create one
74+
set +e
75+
gh search prs -R redis/docs --state open --match title "redis modules docs sync" | grep -q "redis modules docs sync"
76+
if [ "$?" -eq 1 ]; then
77+
set -e
78+
gh pr create \
79+
--body "redis modules docs sync" \
80+
--title "redis modules docs sync" \
81+
--head "$branch" \
82+
--base "main"
83+
fi
84+
fi

assets/css/index.css

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,4 +969,103 @@ code {
969969
/* no-click turns off border and click event on small icons */
970970
a[href*="#no-click"], img[src*="#no-click"] {
971971
@apply border-none cursor-default pointer-events-none no-underline;
972+
}
973+
974+
/* Version selector in side menu */
975+
.menu__version-selector {
976+
float: right;
977+
left: 18px;
978+
padding: 0 22px 0;
979+
position: relative;
980+
top: -28px;
981+
z-index: 1;
982+
border: 1px solid #dfdfdf;
983+
}
984+
985+
.menu__version-selector button {
986+
background: transparent;
987+
border: none;
988+
font-size: 13px;
989+
outline: none;
990+
}
991+
992+
.menu__version-selector button span.menu__version-selector__toggler {
993+
display: none;
994+
font-size: 8px;
995+
transform: translateY(-1px) translateX(2px);
996+
}
997+
998+
.menu__version-selector span.menu__version-selector__toggler.opener {
999+
display: inline-block;
1000+
}
1001+
1002+
.menu__version-selector span.menu__version-selector__toggler.closer {
1003+
display: none;
1004+
}
1005+
1006+
.menu__version-selector .menu__version-selector__list {
1007+
background: #f7f7f7;
1008+
border: 1px solid #dfdfdf;
1009+
border-top: none;
1010+
display: none;
1011+
font-size: 13px;
1012+
left: -1px;
1013+
position: absolute;
1014+
width: calc(100% + 2px);
1015+
z-index: 1;
1016+
}
1017+
1018+
.menu__version-selector .menu__version-selector__list a {
1019+
color: #868484;
1020+
display: block;
1021+
padding-left: 10px;
1022+
width: 100%;
1023+
}
1024+
1025+
.menu__version-selector .menu__version-selector__list a:hover {
1026+
color: #000;
1027+
}
1028+
1029+
.menu__version-selector .menu__version-selector__list a.selected-version {
1030+
display: none;
1031+
}
1032+
1033+
.menu__version-selector.open {
1034+
border: 1px solid #dfdfdf;
1035+
}
1036+
1037+
.menu__version-selector.open .menu__version-selector__toggler.opener {
1038+
display: none;
1039+
}
1040+
1041+
.menu__version-selector.open .menu__version-selector__toggler.closer {
1042+
display: inline-block;
1043+
}
1044+
1045+
.menu__version-selector.open .menu__version-selector__list {
1046+
display: block;
1047+
}
1048+
1049+
.menu__version-selector > li .menu-divider {
1050+
border-top: 1px solid #5d6876;
1051+
height: 1px;
1052+
left: 20px;
1053+
margin-left: 0 !important;
1054+
position: absolute;
1055+
top: 10px;
1056+
width: calc(100% - 20px);
1057+
}
1058+
1059+
.menu__version-selector > li > .children {
1060+
display: none;
1061+
}
1062+
1063+
.menu__version-selector > li.parent > .children {
1064+
display: flex;
1065+
position: relative;
1066+
padding-top: 60px;
1067+
}
1068+
1069+
.dd-item .highlight:hover {
1070+
color: #5961ff;
9721071
}

build/components/example.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
GO_OUTPUT = 'Output:'
1212
TEST_MARKER = {
1313
'java': '@Test',
14-
'c#': '\[Fact\]'
14+
'c#': '\[Fact\]|\[SkipIfRedis\(.*\)\]'
1515
}
1616
PREFIXES = {
1717
'python': '#',
1818
'node.js': '//',
1919
'java': '//',
2020
'go': '//',
2121
'c#': '//',
22-
'redisvl': '#'
22+
'redisvl': '#',
23+
'php': '//'
2324
}
2425

26+
2527
class Example(object):
2628
language = None
2729
path = None

build/components/markdown.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def make_command_linkifier(commands: dict, name: str):
138138
def linkifier(m):
139139
command = m.group(1)
140140
if command in commands and command not in exclude:
141-
return f'[`{command}`](/commands/{command_filename(command)})'
141+
return f'[`{command}`]({{{{< relref "/commands/{command_filename(command)}" >}}}})'
142142
else:
143143
return m.group(0)
144144
return linkifier

build/update_cmds.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
from components.syntax import Command
3+
from components.markdown import Markdown
4+
import json
5+
6+
if __name__ == '__main__':
7+
with open('data/commands_core.json', 'r') as f:
8+
j = json.load(f)
9+
10+
board = []
11+
for k in j:
12+
v = j.get(k)
13+
c = Command(k, v)
14+
sf = c.syntax()
15+
path = f'content/commands/{k.lower().replace(" ", "-")}/'
16+
md = Markdown(f'{path}index.md')
17+
md.fm_data |= v
18+
md.fm_data.update({
19+
'syntax_str': str(c),
20+
'syntax_fmt': sf,
21+
})
22+
if 'replaced_by' in md.fm_data:
23+
replaced = md.generate_commands_links(k, j, md.fm_data['replaced_by'])
24+
md.fm_data['replaced_by'] = replaced
25+
md.persist()

content/apis/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ Redis Cloud is a fully managed Database as a Service offering and the fastest wa
4545

4646
- [Redis Cloud REST API introduction]({{< relref "/operate/rc/api/" >}})
4747
- [Redis Cloud REST API examples]({{< relref "/operate/rc/api/examples/" >}})
48-
- [Redis Cloud REST API reference]({{< relref "/operate/rs/references/rest-api/" >}})
48+
- [Redis Cloud REST API reference](https://api.redislabs.com/v1/swagger-ui.html)
4949

5050

5151
### Redis Enterprise Software API
5252
If you have installed Redis Enterprise Software, you can automate operations with the Redis Enterprise REST API.
5353

54-
- [Redis Enterprise Software REST API introduction]({{< relref "/operate/rc/api/" >}})
54+
- [Redis Enterprise Software REST API introduction]({{< relref "/operate/rs/references/rest-api/" >}})
5555
- [Redis Enterprise Software REST API requests]({{< relref "/operate/rs/references/rest-api/requests/" >}})
5656
- [Redis Enterprise Software REST API objects]({{< relref "/operate/rs/references/rest-api/objects/" >}})
5757

content/commands/client-caching/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ title: CLIENT CACHING
4343
This command controls the tracking of the keys in the next command executed
4444
by the connection, when tracking is enabled in `OPTIN` or `OPTOUT` mode.
4545
Please check the
46-
[client side caching documentation]({{< relref "/develop/use/client-side-caching" >}}) for
46+
[client side caching documentation]({{< relref "/develop/connect/clients/client-side-caching" >}}) for
4747
background information.
4848

4949
When tracking is enabled Redis, using the [`CLIENT TRACKING`]({{< relref "/commands/client-tracking" >}}) command, it is

content/commands/client-getredir/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ syntax_str: ''
3131
title: CLIENT GETREDIR
3232
---
3333
This command returns the client ID we are redirecting our
34-
[tracking]({{< relref "/develop/use/client-side-caching" >}}) notifications to. We set a client
34+
[tracking]({{< relref "/develop/connect/clients/client-side-caching#tracking" >}}) notifications to. We set a client
3535
to redirect to when using [`CLIENT TRACKING`]({{< relref "/commands/client-tracking" >}}) to enable tracking. However in
3636
order to avoid forcing client libraries implementations to remember the
3737
ID notifications are redirected to, this command exists in order to improve

0 commit comments

Comments
 (0)