Corrected steps for checkout #5
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' | |
# For a push event, we need all history for git describe | |
fetch-depth: ${{ github.event_name == 'pull_request' && 1 || 0 }} | |
- 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: Gather version name from git describe | |
id: version | |
if: github.event_name == 'push' | |
run: echo version=$(git describe --tags --dirty) >> $GITHUB_OUTPUT | |
- name: Publish to GitHub Packages | |
if: github.event_name == 'push' | |
run: ./gradlew publish | |
env: | |
GITHUB_USER: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ steps.version.outputs.version }} |