Skip to content

Gradle Build

Gradle Build #42

Workflow file for this run

# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Gradle Build
env:
GPG_KEY_ID: ${{ secrets.MAVEN_SIGN_KEY_ID }}
GPG_KEY: ${{ secrets.MAVEN_SIGN_KEY }}
GPG_PWD: ${{ secrets.MAVEN_SIGN_KEY_PWD }}
MAVEN_USER: ${{ secrets.MAVEN_USER_NAME }}
MAVEN_KEY: ${{ secrets.MAVEN_USER_PWD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: 17
- name: PGP Prepare
run: |
echo "Create .gpg key"
echo "$GPG_KEY" > ./release.asc
gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc
sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties
sed -i -e "s,signing.password=,signing.password=$GPG_PWD,g" gradle.properties
sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties
cat gradle.properties
- name: Build with Gradle
run: gradle clean build -x test
- name: Publish to GitHub Packages
run: gradle publishToGitHubPackages
- name: Publish to Maven Central
run: gradle publishToSonatype closeAndReleaseSonatypeStagingRepository