Skip to content

Commit 505a9ad

Browse files
Documentation page and GitHub action
1 parent 3fb5196 commit 505a9ad

6 files changed

Lines changed: 118 additions & 148 deletions

File tree

.github/workflows/build-docs-gh-pages.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: publish-docs-gp-pages
2+
3+
on:
4+
# TODO: Can we trigger action manually?
5+
# push:
6+
# branches:
7+
# - 4.x
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-docs:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
# 1. Checkout doc branch
18+
- name: Checkout current branch
19+
uses: actions/checkout@v4
20+
with:
21+
path: java-driver
22+
23+
# 2. Java 8
24+
- name: Set up Java 8
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: temurin
28+
java-version: "8"
29+
cache: maven
30+
31+
# 3. Python 3.10.19 + MkDocs + plugins
32+
- name: Set up Python 3.10.19
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.10.19"
36+
37+
- name: Install MkDocs dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install \
41+
mkdocs \
42+
mkdocs-material \
43+
mkdocs-awesome-pages-plugin \
44+
mkdocs-macros-plugin \
45+
mike
46+
47+
# 4. Build docs via build-doc.sh
48+
- name: Build documentation
49+
working-directory: java-driver
50+
run: |
51+
chmod +x ./build-doc.sh
52+
./build-doc.sh
53+
54+
# 5. Checkout gh-pages branch
55+
- name: Checkout GH pages branch
56+
uses: actions/checkout@v4
57+
with:
58+
ref: gh-pages
59+
path: gh-pages
60+
61+
- name: Copy and version documentation
62+
working-directory: gh-pages
63+
run: |
64+
git config --global user.email "gha@cassandra.apache.org"
65+
git config --global user.name "GHA for Apache Cassandra Website"
66+
67+
cd ../java-driver
68+
# lookup current project version
69+
release_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1)
70+
# update links to contain version prefix
71+
mike deploy --update-aliases $release_version
72+
# copy documentation web page folder
73+
cd ../gh-pages
74+
cp -r ../java-driver/docs ./
75+
rm -rf $release_version
76+
mv docs $release_version
77+
78+
# update latest symlink
79+
rm latest
80+
ln -s $release_version latest
81+
82+
# remove latest tag
83+
sed -i 's/\"latest\"//g' versions.json
84+
# remove already present line if exists
85+
sed -i '/'"$release_version"'/d' versions.json
86+
# insert new version at the beginning
87+
sed -i '2s/^/ { "version": "'"$release_version"'", "title": "'"$release_version"'", "aliases": ["latest"] },\'$'\n/g' versions.json
88+
89+
echo "release_version=$release_version" >> "$GITHUB_ENV"
90+
91+
- name: Commit and push documentation
92+
working-directory: gh-pages
93+
run: |
94+
git config --global user.email "gha@cassandra.apache.org"
95+
git config --global user.name "GHA for Apache Cassandra Website"
96+
97+
git add .
98+
99+
if git diff --cached --quiet; then
100+
echo "No changes to push to gh-pages"
101+
exit 0
102+
fi
103+
104+
git commit -m "Update generated docs for release ${release_version}"
105+
git push origin gh-pages

.github/workflows/update-docs-staging.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

faq/favicon.ico

16.5 KB
Binary file not shown.

faq/logo.png

28.1 KB
Loading

mkdocs.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ site_dir: docs
99

1010
theme:
1111
name: material
12-
palette:
13-
- scheme: default
14-
primary: blue
15-
accent: blue
12+
logo: faq/logo.png
13+
favicon: faq/favicon.ico
1614
features:
1715
- navigation.tabs
18-
- navigation.sections
1916
- navigation.top
17+
- navigation.path
2018
- search.highlight
2119
- search.share
2220

@@ -26,6 +24,7 @@ markdown_extensions:
2624
- pymdownx.superfences
2725
- pymdownx.tabbed
2826
- toc:
27+
toc_depth: 1
2928
permalink: true
3029

3130
nav:
@@ -39,8 +38,8 @@ nav:
3938
- Overview: manual/core/README.md
4039
- Integration: manual/core/integration/README.md
4140
- Configuration:
42-
- Overview: manual/core/configuration/README.md
43-
- Reference: manual/core/configuration/reference/README.md
41+
- Overview: manual/core/configuration/README.md
42+
- Reference: manual/core/configuration/reference/README.md
4443
- Authentication: manual/core/authentication/README.md
4544
- SSL: manual/core/ssl/README.md
4645
- Load Balancing: manual/core/load_balancing/README.md
@@ -162,3 +161,10 @@ plugins:
162161
- search
163162
- awesome-pages
164163
- macros
164+
- mike:
165+
alias_type: copy
166+
167+
extra:
168+
generator: false
169+
version:
170+
provider: mike

0 commit comments

Comments
 (0)