File tree Expand file tree Collapse file tree 5 files changed +781
-4
lines changed
Expand file tree Collapse file tree 5 files changed +781
-4
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy to Sonatype Central
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*' # Trigger the workflow when a tag starting with 'v' is pushed, like v1.0.0
7+
8+ jobs :
9+ deploy :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v5
15+
16+ - name : Set up JDK 21
17+ uses : actions/setup-java@v5
18+ with :
19+ java-version : ' 21'
20+ distribution : ' adopt'
21+
22+ - name : Cache Maven dependencies
23+ uses : actions/cache@v4
24+ with :
25+ path : ~/.m2/repository
26+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+ restore-keys : |
28+ ${{ runner.os }}-maven-
29+
30+ - name : Import GPG key
31+ run : |
32+ echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import --armor --batch --no-tty
33+
34+ - name : Setup Maven settings
35+ run : |
36+ rm ${HOME}/.m2/settings.xml
37+
38+ cat << EOF > ${HOME}/.m2/settings.xml
39+ <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
40+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
41+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
42+ <servers>
43+ <server>
44+ <id>central</id>
45+ <username>${{ secrets.SONATYPE_USERNAME }}</username>
46+ <password>${{ secrets.SONATYPE_PASSWORD }}</password>
47+ </server>
48+ </servers>
49+ </settings>
50+ EOF
51+
52+ - name : Deploy to Sonatype Central
53+ run : |
54+ ./mvnw clean deploy --batch-mode -Prelease \
55+ -Dgpg.keyname=${{ secrets.GPG_KEY_ID }}
You can’t perform that action at this time.
0 commit comments