-
Notifications
You must be signed in to change notification settings - Fork 735
89 lines (77 loc) · 3 KB
/
publish_release_branch.yml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Publish package to the Maven Central Repository
on:
push:
branches:
- release/*
# this is required by spotless for JDK 16+
env:
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"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Maven Install and Site with Code Coverage
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B clean install site -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
- uses: actions/upload-artifact@v4
with:
name: maven-release-target-directory
path: target/
retention-days: 3
publish_package:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: sonatype-nexus-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish package
run: mvn -B clean deploy -DskipTests -Prelease
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
MAVEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSPHRASE }}
publish_gh_pages:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/release/v2.x' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Release Version
id: release
run: |
echo "version=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: maven-release-target-directory
path: target
- name: Checkout GH Pages
run: |
git checkout -B gh-pages origin/gh-pages
find . -type f -and -not -path './target/*' -and -not -path './.*' -and -not -name CNAME -delete
cp -r ./target/site/* ./
- name: Publish GH Pages
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Release (${{ github.actor }}): v${{ steps.release.outputs.version }}"
branch: gh-pages