Skip to content

Commit 375ce52

Browse files
committed
use GitHub Actions Publish package to the Maven Central Repository
1 parent 9435e52 commit 375ce52

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
push:
4+
tags: [ "*" ]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Maven Central Repository
11+
uses: actions/setup-java@v2
12+
with:
13+
java-version: '8'
14+
distribution: 'adopt'
15+
server-id: ossrh
16+
server-username: MAVEN_USERNAME
17+
server-password: MAVEN_PASSWORD
18+
- id: install-secret-key
19+
name: Install gpg secret key
20+
run: |
21+
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
22+
gpg --list-secret-keys --keyid-format LONG
23+
- name: Publish package
24+
env:
25+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
26+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
27+
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -P release clean deploy

pom.xml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<groupId>com.github.pagehelper</groupId>
3030
<artifactId>pagehelper</artifactId>
31-
<version>5.3.0</version>
31+
<version>5.3.1-SNAPSHOT</version>
3232
<packaging>jar</packaging>
3333

3434
<name>pagehelper 5</name>
@@ -274,16 +274,32 @@
274274
</goals>
275275
</execution>
276276
</executions>
277+
<configuration>
278+
<gpgArguments>
279+
<argument>--pinentry-mode</argument>
280+
<argument>loopback</argument>
281+
</gpgArguments>
282+
</configuration>
283+
</plugin>
284+
<plugin>
285+
<groupId>org.sonatype.plugins</groupId>
286+
<artifactId>nexus-staging-maven-plugin</artifactId>
287+
<extensions>true</extensions>
288+
<configuration>
289+
<serverId>ossrh</serverId>
290+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
291+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
292+
</configuration>
277293
</plugin>
278294
</plugins>
279295
</build>
280296
<distributionManagement>
281297
<snapshotRepository>
282-
<id>oss</id>
298+
<id>ossrh</id>
283299
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
284300
</snapshotRepository>
285301
<repository>
286-
<id>oss</id>
302+
<id>ossrh</id>
287303
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
288304
</repository>
289305
</distributionManagement>

0 commit comments

Comments
 (0)