Skip to content

Roll up to 1.1.1-SNAPSHOT. #73

Roll up to 1.1.1-SNAPSHOT.

Roll up to 1.1.1-SNAPSHOT. #73

Workflow file for this run

name: Deploy to Central
on:
# Trigger on push to main (usually for Snapshots)
push:
branches: [ "main" ]
tags:
- 'v*'
# Trigger when a Release is published in GitHub UI
release:
types: [ published ]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK 25 & Maven
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: 'maven'
# AUTO-CONFIGURATION:
# This creates a settings.xml with the <server> id "sonatype-central"
server-id: sonatype-central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Build & Deploy
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]] || [[ "${{ github.event_name }}" == "release" ]]; then
# For releases/tags: Sign artifacts and use the central portal
mvn deploy -DskipTests -P release,uberjar -ntp
else
# For snapshots: Force deployment to the Sonatype snapshot repo
mvn deploy -DskipTests -P release -ntp -DaltSnapshotDeploymentRepository=sonatype-central::default::https://central.sonatype.com/repository/maven-snapshots/
fi
- name: Create/Update GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
target/gemini-java-client-uber-*.jar
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}