Skip to content

Commit 5703ade

Browse files
authored
Merge pull request #678 from redis/DOC-4273
Set baseURL for every build
2 parents 4fe73ee + fcfdddb commit 5703ade

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/workflows/main-staging.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,31 @@ 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
52-
run: make deps
58+
}
5359
54-
- name: Build out all versions
55-
run: |
56-
set -x
57-
60+
setBaseUrl
5861
kubernetes_versions=($(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
5962
rs_versions=($(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
6063
@@ -72,6 +75,8 @@ jobs:
7275
# build all versions
7376
for version in "${kubernetes_versions[@]}"; do
7477
78+
setBaseUrl
79+
7580
# for each version, remove all other versions before building
7681
versions_to_remove=($(echo "${kubernetes_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
7782
for version_to_remove in "${versions_to_remove[@]}"; do
@@ -93,6 +98,8 @@ jobs:
9398
9499
for version in "${rs_versions[@]}"; do
95100
101+
setBaseUrl
102+
96103
# for each version, remove all other versions before building
97104
versions_to_remove=($(echo "${rs_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
98105
for version_to_remove in "${versions_to_remove[@]}"; do

0 commit comments

Comments
 (0)