-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.66 KB
/
deploy.yml
File metadata and controls
58 lines (48 loc) · 1.66 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 Sonatype Central
on:
push:
tags:
- 'v*' # Trigger the workflow when a tag starting with 'v' is pushed, like v1.0.0
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'adopt'
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Import GPG key
run: |
echo "${{ secrets.MVN_GPG_PRIVATE_KEY }}" | gpg --import --armor --batch --no-tty
gpg --list-keys
- name: Setup Maven settings
run: |
rm ${HOME}/.m2/settings.xml
cat << EOF > ${HOME}/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${{ secrets.SONATYPE_USERNAME }}</username>
<password>${{ secrets.SONATYPE_PASSWORD }}</password>
</server>
</servers>
</settings>
EOF
- name: Deploy to Sonatype Central
run: |
./mvnw clean deploy --batch-mode -Prelease \
-Dgpg.keyname=${{ secrets.MVN_GPG_KEY_ID }}