Skip to content

Commit d9e26fd

Browse files
authored
Create publish_release_branch.yml
1 parent b2b3e1c commit d9e26fd

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
push:
4+
branches:
5+
- release/*
6+
7+
# this is required by spotless for JDK 16+
8+
env:
9+
JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Maven Central Repository
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
21+
cache: 'maven'
22+
server-id: sonatype-nexus-staging
23+
server-username: MAVEN_USERNAME
24+
server-password: MAVEN_PASSWORD
25+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
26+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
27+
- name: Maven Install and Site with Code Coverage
28+
env:
29+
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
30+
run: mvn -B clean install site -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
31+
32+
- uses: actions/upload-artifact@v3
33+
with:
34+
name: maven-target-directory
35+
path: target/
36+
retention-days: 3
37+
38+
- name: Publish package
39+
run: mvn -B clean deploy -DskipTests -Prelease
40+
env:
41+
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
42+
MAVEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
43+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
44+
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSPHRASE }}

0 commit comments

Comments
 (0)