-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (54 loc) · 1.93 KB
/
dokka.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Dokka for Github Pages
# This workflow will:
# 1. Trigger on a push to the `main` branch.
# 2. Check out the repository.
# 3. Set up JDK 19.
# 4. Build the project using Gradle.
# 5. Generate Dokka HTML documentation.
# 6. Move the generated documentation to the `/docs` directory.
# 7. Commit and push the changes to the `main` branch, updating GitHub Pages.
on:
push:
branches:
- main
jobs:
dokka:
runs-on: ubuntu-latest
permissions:
contents: write # Ensure the token has write permissions to the repository
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 19
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '19'
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Generate Dokka HTML
run: ./gradlew :lib:dokkaHtml
# Move Dokka HTML files to the /docs folder
- name: Move Dokka HTML to /docs
run: |
rm -rf docs/*
mv lib/build/dokka/html/* docs/
# Commit and push changes to the /docs folder
- name: Commit and push changes
run: |
git config --local user.name "GitHub Actions [bot]"
git config --local user.email "actions@users.noreply.github.com"
git add docs/
# Check if there are any changes staged
if ! git diff --cached --exit-code >/dev/null; then
git commit -m "Update Dokka HTML documentation"
git push origin main
else
echo "No changes to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}