Merge pull request #34 from petebankhead/close-windows #4
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 Javadocs | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
build-and-publish-javadocs: | |
permissions: | |
pages: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build Javadocs | |
run: ./gradlew javadoc | |
- name: Publish Javadocs to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# fake ternary, see https://github.com/orgs/community/discussions/26738#discussioncomment-3253176 | |
destination_dir: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }} | |
publish_dir: ./build/docs/javadoc | |
publish_branch: gh-pages | |
allow_empty_commit: true | |
update-symlink: | |
permissions: | |
pages: write | |
contents: write | |
needs: build-and-publish-javadocs | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: Update stable symlink | |
run: | | |
rm stable | |
ln -s ${{ github.ref_name }} stable | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add stable | |
git commit -m "Update stable symlink to ${{ github.ref_name }}" | |
git push origin gh-pages |