I've successfully generated the Kotlin doc using Dokka for Android projects. Now how can I publish to Github Pages.
Asked
Active
Viewed 1,241 times
1 Answers
4
Use one of the Github Pages actions.
On one of my projects I've used JamesIves/github-pages-deploy-action. Here's an example:
name: Docs
on:
push:
branches: [master]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build documentation
run: ./gradlew asciidoctor
- name: Publish documentation
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: build/docs
You'll need to adapt the build step to your build process and tweak the path where the docs are generated.
You'll also need to define the ACCESS_TOKEN
secret (Settings -> Secrets in your repository). The token can be generate in your profile Settings -> Developer Settings -> Personal access tokens.
There's more actions to choose from , i.e. https://github.com/marketplace/actions/github-pages-action, so do your research and choose the one that suits you best.

Jakub Zalas
- 35,761
- 9
- 93
- 125