Skip to content

Update Gradle to v9 #159

Update Gradle to v9

Update Gradle to v9 #159

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Prepare
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: gittools/actions/gitversion/setup@v0.13.6
with:
versionSpec: '5.12.x'
- uses: gittools/actions/gitversion/execute@v0.13.6
id: gitversion
- name: Set version (release)
if: github.ref_type == 'tag'
run: echo "VERSION=${{steps.gitversion.outputs.semVer}}" >> $GITHUB_ENV
- name: Set version (pre-release)
if: github.ref_type != 'tag'
run: echo "VERSION=${{steps.gitversion.outputs.semVer}}-${{steps.gitversion.outputs.shortSha}}" >> $GITHUB_ENV
# Build
- run: gradle build
- run: gradle dokkaGenerateHtml
- run: gradle test
- name: Report test results
if: always()
uses: dorny/test-reporter@v2
with:
name: Test Report
reporter: java-junit
path: '*/build/test-results/test/TEST-*.xml'
# Release
- name: Get tag message
if: github.ref_type == 'tag'
id: tag_message
run: |
{
echo "message<<EOF"
git fetch -f origin tag ${{github.ref_name}}
git tag -l ${{github.ref_name}} --format="%(contents)"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
body: |
**[Maven package](https://central.sonatype.com/artifact/net.typedrest/typedrest/${{steps.gitversion.outputs.semVer}})**
## Changes
${{steps.tag_message.outputs.message}}
# Publish
- name: Publish packages (GitHub)
if: github.event_name == 'push' && github.ref_type != 'tag' && !startsWith(github.ref_name, 'renovate/')
run: gradle publishAllPublicationsToGitHubRepository
env:
GITHUB_ACTOR: ${{github.actor}}
GITHUB_TOKEN: ${{github.token}}
- name: Publish packages (Maven Central)
if: github.ref_type == 'tag'
run: gradle publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GPG_KEY: ${{secrets.GPG_KEY}}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.SONATYPE_USERNAME}}
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
- name: Publish documentation
if: github.ref_type == 'tag'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{github.token}}
force_orphan: true
publish_dir: build/dokka/html
cname: java.typedrest.net