-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (43 loc) · 1.61 KB
/
deploy.yml
File metadata and controls
48 lines (43 loc) · 1.61 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
name: Deploy to Central
on:
# Trigger on push to main (usually for Snapshots)
push:
branches: [ "main" ]
# Trigger when a Release is published in GitHub UI
release:
types: [ published ]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
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.event_name }}" == "release" ]]; then
# For releases: Sign artifacts and use the central portal
mvn deploy -DskipTests -P release -ntp
else
# For snapshots: Force deployment to the Sonatype snapshot repo with the release profile for sources/javadocs
mvn deploy -DskipTests -P release -ntp -DaltSnapshotDeploymentRepository=sonatype-central::default::https://central.sonatype.com/repository/maven-snapshots/
fi