Skip to content

CASSJAVA-109, CASSJAVA-117: Manual and API References after donation, Build CI for Java Driver Doc: #2

CASSJAVA-109, CASSJAVA-117: Manual and API References after donation, Build CI for Java Driver Doc:

CASSJAVA-109, CASSJAVA-117: Manual and API References after donation, Build CI for Java Driver Doc: #2

name: Update gh-pages-staging on commit
on:
push:
branches:
- 4.x
# for testing only, TODO: remove push
pull_request:
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 1. Checkout doc branch
- name: Checkout current branch
uses: actions/checkout@v4
with:
path: java-driver
# 2. Java 8
- name: Set up Java 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "8"
cache: maven # <--- cache Maven deps (~/.m2/repository)
# 3. Python 3.10.19 + MkDocs + plugins
- name: Set up Python 3.10.19
uses: actions/setup-python@v5
with:
python-version: "3.10.19"
- name: Install MkDocs dependencies
run: |
python -m pip install --upgrade pip
pip install \
mkdocs \
mkdocs-material \
mkdocs-awesome-pages-plugin \
mkdocs-macros-plugin
# 4. Build docs via build-doc.sh
- name: Build documentation
working-directory: java-driver
run: |
chmod +x ./build-doc.sh
./build-doc.sh
# 6. Checkout gh-pages-staging branch
- name: Checkout gh-pages-staging
uses: actions/checkout@v4
with:
ref: gh-pages-staging
path: gh-pages-staging
- name: Copy and Build Doc
working-directory: gh-pages-staging
run: |
cp -r ../java-driver/docs ./docs/latest
mkdocs build
cp -r ./out/. . # because the index.html has to be in the root folder
- name: Commit and push to gh-pages-staging
working-directory: gh-pages-staging
run: |
git config --global user.email "[email protected]"
git config --global user.name "GHA for Apache Cassandra Website"
git add .
if git diff --cached --quiet; then
echo "No changes to push to gh-pages."
exit 0
fi
git commit -m "Update generated docs"
git push origin gh-pages-staging