aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/gh-pages.yml
blob: c444a3e49b11a038f1d828b67db38001a017696f (plain)
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
name: Build and deploy MkDocs to GitHub Pages

on:
  push:
    branches:
      - master
  release:
    types: [published]

jobs:
  docs:
    if: github.repository == 'Kotlin/dokka'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout dokka
        uses: actions/checkout@v2
        with:
          path: dokka

      - uses: dorny/paths-filter@v2
        id: filter
        with:
          filters: |
            docs_changed:
              - 'docs/**'
          working-directory: ./dokka

      - uses: actions/setup-java@v2
        with:
          distribution: 'zulu'
          java-version: 11

      - name: Get current dokka version
        run: echo "DOKKA_VERSION=`./gradlew :properties | grep '^version:.*' | cut -d ' ' -f 2 | cut -d '-' -f 1`" >> $GITHUB_ENV
        if: github.event_name == 'release' || steps.filter.outputs.docs_changed == 'true'
        working-directory: ./dokka

      - name: Build docs
        run: ./gradlew mkdocsBuild -Pdokka_version=$DOKKA_VERSION --info
        if: github.event_name == 'release' || steps.filter.outputs.docs_changed == 'true'
        working-directory: ./dokka

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        if: github.event_name == 'release' || steps.filter.outputs.docs_changed == 'true'
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dokka/docs/build/mkdocs
          keep_files: true
          full_commit_message: Publish ${{ env.DOKKA_VERSION }} documentation