generated from LarsBodewig/Template
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (37 loc) · 1.21 KB
/
maven-publish.yml
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
# Builds the project with Maven Wrapper using the 'release' profile and publishes to Maven Central
# ---
# Add the following Github secrets from your Secret Manager
# - MAVEN_USERNAME: your Sonatype username
# - MAVEN_CENTRAL_TOKEN: an Access Token generated in your Sonatype profile
# - MAVEN_GPG_PASSPHRASE: your GPG passphrase
# - MAVEN_GPG_PRIVATE_KEY: your GPG private key
name: Maven Publish
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '17'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Apache Maven Central
run: mvn clean deploy -B -P release
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}