-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (65 loc) · 2.2 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Maven Package
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
settings-path: ${{ github.workspace }}
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
gpg --list-secret-keys
- name: Verify GPG Passphrase
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "test message" | gpg --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --local-user your-key-id
gpg --list-secret-keys
- name: Set up Maven settings
run: |
mkdir -p ~/.m2
echo "<settings>
<servers>
<server>
<id>ossrh</id>
<username>${{ secrets.OSSRH_USERNAME }}</username>
<password>${{ secrets.OSSRH_PASSWORD }}</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg-sign</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>[email protected]</gpg.keyname>
<gpg.passphrase>${{ secrets.GPG_PASSPHRASE }}</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gpg-sign</activeProfile>
</activeProfiles>
</settings>" > ~/.m2/settings.xml
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to OSSRH
run: mvn deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}