Better logging and corrected gradle task #7
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: Gradle Package | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Verify build for PR | |
run: ./gradlew check | |
if: github.event_name == 'pull_request' | |
- name: Unshallow git for push event so we can do git describe | |
run: git fetch --prune --unshallow | |
if: github.event_name == 'push' | |
- name: Gather version name from git describe | |
id: version | |
if: github.event_name == 'push' | |
run: echo version=$(git describe --tags --dirty) | tee $GITHUB_OUTPUT | |
- name: Publish to GitHub Packages | |
if: github.event_name == 'push' | |
run: ./gradlew publishAllPublicationsToGithubRepository | |
env: | |
GITHUB_USER: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ steps.version.outputs.version }} |