Merge pull request #735 from modelix/bugfix/drop-unneeded-ktlint-vers… #58
Workflow file for this run
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: Build and Publish Docs | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.0' # New Major or Minor Releases | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Use tag as version | |
run: echo "${GITHUB_REF#refs/*/}" > version.txt | |
- name: Checkout Old Docs Versions for Index Page | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: build/dokka | |
- name: Generate Docs with Dokka | |
run: ./gradlew dokkaHtmlMultiModule | |
- name: Create symlink to latest version | |
run: | | |
cd build/dokka | |
latestVersion=$(for n in *; do printf '%s\n' "$n"; done | sort -V | grep -E "^[0-9]+\.[0-9]+" | tail -n1) | |
if [[ -n "${latestVersion}" ]]; then | |
ln -sf ${latestVersion} latest | |
fi | |
- name: Publish to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: build/dokka | |
keep_files: true |