-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.77 KB
/
deploy.yml
File metadata and controls
58 lines (52 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Deploy to Central
on:
# Trigger on push to main (for Snapshots)
push:
branches: [ "main" ]
tags:
- 'v*'
# Manual trigger allowed
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'
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* ]]; 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 }}