Skip to content

Commit 79910d7

Browse files
Create maven-central-repo-publish.yml
1 parent 94bb72c commit 79910d7

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Java CI with Maven
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the main branch
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
branches: [ main ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
build:
19+
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up JDK 1.8
25+
uses: actions/setup-java@v2
26+
with:
27+
java-version: 8
28+
distribution: 'adopt'
29+
server-id: ossrh
30+
server-username: OSSRH_USERNAME
31+
server-password: OSSRH_PASSWORD
32+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
33+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
34+
- name: Build with Maven
35+
run: mvn -B compile --file pom.xml
36+
37+
- name: Publish to Apache Maven Central
38+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
39+
run: mvn -DskipTests deploy -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }}
40+
env:
41+
OSSRH_USERNAME: ${{ secrets.MAVEN_USERNAME }}
42+
OSSRH_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
43+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)