Upgrade CI to JDK 17 #112
This file contains hidden or 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 CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
release: | |
types: [ published ] | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
detekt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
ref: ${{ github.head_ref }} | |
- name: Setup detekt | |
uses: peter-murray/setup-detekt@v2 | |
with: | |
detekt_version: 1.22.0 | |
- name: Run detekt | |
run: detekt-cli -c gradle/detekt/detekt.yml | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
env: | |
PACKAGE_VERSION: ${{ github.event.release.tag_name }} | |
run: ./gradlew build | |
release: | |
if: ${{ github.event_name == 'release' }} | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Release to sonatype | |
env: | |
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} | |
GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }} | |
PACKAGE_VERSION: ${{ github.event.release.tag_name }} | |
run: ./gradlew publishJsPublicationToMavenRepository | |
publish: | |
if: ${{ github.event_name == 'release' }} | |
needs: | |
- build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Generate docs with dokka | |
env: | |
PACKAGE_VERSION: ${{ github.event.release.tag_name }} | |
run: ./gradlew dokkaGeneratePublicationHtml | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ${{ github.workspace }}/build/dokka/html | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |