Merge pull request #15 from bsautner/dependabot/gradle/ksp-2.1.10-1.0.30 #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Dokka API Docs | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
pages: write | |
jobs: | |
deploy-dokka: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Check out the main branch to build the docs | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
# 2. Set up the Java environment (adjust java-version as needed) | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
# 3. Run your Gradle Dokka generation task | |
- name: Build Dokka API docs | |
run: ./gradlew :api:dokkaGenerate | |
# 4. Check out the existing gh-pages branch into a subdirectory called "gh-pages" | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: gh-pages | |
# 5. Copy the generated Dokka docs into the "api-docs" folder of the gh-pages branch | |
- name: Copy Dokka docs into api-docs folder | |
run: | | |
mkdir -p gh-pages/api-docs | |
rm -rf gh-pages/api-docs/* | |
cp -R api/build/dokka/html/* gh-pages/api-docs | |
# 6. Commit and push changes (only if there are differences) | |
- name: Commit and push changes | |
working-directory: gh-pages | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add api-docs | |
if git diff --cached --quiet; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update Dokka API docs" | |
git push origin gh-pages | |
fi |