Skip to content

Java

Java #22

Workflow file for this run

name: Java
on:
create:
tags: [ 'v*.*.*' ]
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write
packages: read
jobs:
java:
name: Java
runs-on: ubuntu-latest
defaults:
run:
shell: bash {0}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Cache Gradle
uses: actions/cache@v4
with:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
path: |
~/.gradle/caches
~/.gradle/wrapper
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
run: chmod +x gradlew
- name: Build
env:
BUILD_NUMBER: ${{ github.run_number }}
run: ./gradlew build --console=plain --refresh-dependencies
- name: Publish
if: github.event_name == 'create' && github.event.ref_type == 'tag'
run: ./gradlew publish --console=plain
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Setup Release
if: github.event_name == 'create' && github.event.ref_type == 'tag'
run: echo "release_name=${GITHUB_REPOSITORY#*/} ${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: Release
if: github.event_name == 'create' && github.event.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
files: ./cli/build/libs/*.jar
generate_release_notes: true
name: ${{ env.release_name }}