-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (35 loc) · 1.39 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
39
40
41
42
43
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
name: Maven Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
settings-path: ${{ github.workspace }} # location for the settings.xml file
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build with Maven
run: mvn -B package -P ossrh
- name: Build GPG Key
run: |
mkdir -p ~/.gnupg/
echo "$GPG_SECRET_KEY" > ~/.gnupg/private.key
gpg --no-tty --batch --yes --passphrase $GPG_PASSPHRASE --import ~/.gnupg/private.key
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
- name: Publish to Maven Central
run: mvn --batch-mode -s $GITHUB_WORKSPACE/.m2/settings.xml deploy -P ossrh -Dmaven.test.skip -Dmaven.main.skip -Dmaven.install.skip -Dgpg.passphrase=$GPG_PASSPHRASE
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}