chore(deps): Update build deps and github actions #239
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: Java CI with Gradle | |
on: | |
push: | |
branches: [ "**" ] | |
tags-ignore: [ "**" ] | |
pull_request: | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}" | |
cancel-in-progress: true | |
permissions: | |
actions: write | |
contents: read | |
jobs: | |
build: | |
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
strategy: | |
matrix: | |
java: ["17"] | |
os: ["ubuntu-latest"] | |
fail-fast: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: ${{ matrix.java }} | |
cache: 'gradle' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@main | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@main | |
with: | |
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/master') || github.event_name == 'pull_request' }} | |
arguments: "build --stacktrace" | |
- name: Determine status & prepare for publish | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then | |
echo "STATUS=snapshot" >> $GITHUB_ENV | |
else | |
echo "STATUS=release" >> $GITHUB_ENV | |
fi | |
- name: Publish | |
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/master') }} | |
run: ./gradlew publish -x requireClean -x signMavenPublication | |
env: | |
ORG_GRADLE_PROJECT_mizuleUsername: ${{ secrets.MAVEN_USERNAME }} | |
ORG_GRADLE_PROJECT_mizulePassword: ${{ secrets.MAVEN_PASSWORD }} |