Skip to content

Antora Documents Site #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Deploy Docs
on:
workflow_dispatch:
release:
types: [published]
repository_dispatch:
types: [build-docs]

permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
name: Build and Deploy Docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags
fetch-tags: true # Explicitly fetch tags

- name: Fetch all tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Cache Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: ${{ runner.os }}-gradlew-

- name: Set Release Version in Docs
run: |
VERSION=$(cat gradle.properties | grep "version" | cut -d'=' -f2 | tr -d ' ')
echo "Setting documentation version to $VERSION"

# For current version
sed -i "s/display_version: '.*'/display_version: '$VERSION'/" docs/content/antora.yml
sed -i "s/redis-om-version: '.*'/redis-om-version: '$VERSION'/" docs/content/antora.yml

# Check for existing tag in playbook
if ! grep -q "v$VERSION" docs/antora-playbook.yml; then
if [[ ! "$VERSION" == *-SNAPSHOT ]]; then
echo "Version $VERSION not found in playbook. Adding if tag exists."
# Only add the tag if it exists in the repository
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "Adding version v$VERSION to Antora playbook"
sed -i "/tags:/a \ - v${VERSION}" docs/antora-playbook.yml
fi
fi
fi

- name: Show Git Info
run: |
echo "Available tags:"
git tag -l

echo "Current branch:"
git branch --show-current

echo "Antora playbook content:"
cat docs/antora-playbook.yml

- name: Build Documentation
run: |
cd docs
./gradlew generateSite
if [ ! -d "build/site" ] || [ -z "$(ls -A build/site)" ]; then
echo "Site build failed or directory is empty. Falling back to direct Antora command."
npm install
./node_modules/.bin/antora --fetch --stacktrace --log-format=pretty antora-playbook.yml --to-dir=build/site
fi

- name: Verify Build Output
run: |
if [ ! -d "docs/build/site" ] || [ -z "$(ls -A docs/build/site)" ]; then
echo "ERROR: Documentation build failed. Site directory is empty."
exit 1
fi
echo "Documentation built successfully."
ls -la docs/build/site

- name: Add .nojekyll file
run: touch docs/build/site/.nojekyll

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/build/site'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ jobs:
run: |
sed -i "s/^version\s*=.*/version = ${{ inputs.version }}/" gradle.properties
git add gradle.properties
git commit --allow-empty -m "Releasing version ${{ inputs.version }}"
git commit --allow-empty -m "release: Releasing version ${{ inputs.version }}"
git push origin HEAD

- name: Build
@@ -103,3 +103,9 @@ jobs:
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties

- name: Trigger documentation build
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GIT_ACCESS_TOKEN }}
event-type: build-docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -40,3 +40,4 @@ docs/build/
build/
.gradle/
compile_debug.log
docs/.cache/*
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -548,7 +548,9 @@ dependencies {

## 📚 Documentation

The Redis OM documentation is available [here](docs/index.md).
The Redis OM Spring documentation is available at:
- [Local Documentation](docs/index.md)
- [Online Documentation](https://redis.github.io/redis-om-spring/) (Generated from the main branch)

## Demos

82 changes: 82 additions & 0 deletions docs/.github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Deploy Docs
on:
workflow_dispatch:
release:
types: [published]
repository_dispatch:
types: [build-docs]

permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
name: Build and Deploy Docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Cache Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: ${{ runner.os }}-gradlew-

- name: Set Release Version in Docs
run: |
VERSION=$(cat gradle.properties | grep "version" | cut -d'=' -f2 | tr -d ' ')
echo "Setting documentation version to $VERSION"
sed -i "s/display_version: '.*'/display_version: '$VERSION'/" docs/content/antora.yml
sed -i "s/redis-om-version: '.*'/redis-om-version: '$VERSION'/" docs/content/antora.yml

- name: Build Documentation
run: |
./gradlew :docs:build

- name: Add .nojekyll file
run: touch docs/build/site/.nojekyll

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/build/site'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading