Skip to content

Gradle Build And Release #32

Gradle Build And Release

Gradle Build And Release #32

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 And Release
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
- 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 build -x test -x kspKotlin -x compileJava
- name: Publish to GitHub Packages
run: gradle publishToGitHubPackages
- name: Publish to Maven Central
run: gradle publishToSonatype closeAndReleaseSonatypeStagingRepository