Skip to content

Commit

Permalink
feat: add central-publish.yaml GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
surajkumar committed Dec 11, 2024
1 parent a823179 commit 067436b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/central-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Publish to Sonatype

on:
push:
branches:
- main
pull_request: # test to be removed before merge

env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Gradle
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "oracle"

- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
- name: Configure GPG passphrase
run: |
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback --sign-key ${{ secrets.GPG_KEY_ID }}
- name: Publish to Sonatype
run: ./gradlew publish --no-daemon

- name: Clean up GPG keys
run: gpg --batch --yes --delete-secret-keys ${{ secrets.GPG_KEY_ID }}

0 comments on commit 067436b

Please sign in to comment.