Skip to content

Commit 7dc1d91

Browse files
authored
Add gh-pages to publish workflow
1 parent 35079e5 commit 7dc1d91

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

.github/workflows/publish_release_branch.yml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
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"
1010

1111
jobs:
12-
publish:
12+
build:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
@@ -19,26 +19,66 @@ jobs:
1919
java-version: '17'
2020
distribution: 'temurin'
2121
cache: 'maven'
22-
server-id: sonatype-nexus-staging
23-
server-username: MAVEN_USERNAME
24-
server-password: MAVEN_PASSWORD
25-
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
26-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
22+
2723
- name: Maven Install and Site with Code Coverage
2824
env:
2925
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
3026
run: mvn -B clean install site -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
3127

3228
- uses: actions/upload-artifact@v4
3329
with:
34-
name: maven-target-directory
30+
name: maven-release-target-directory
3531
path: target/
3632
retention-days: 3
37-
33+
34+
publish_package:
35+
runs-on: ubuntu-latest
36+
needs: build
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Set up Maven Central Repository
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: '17'
43+
distribution: 'temurin'
44+
cache: 'maven'
45+
server-id: sonatype-nexus-staging
46+
server-username: MAVEN_USERNAME
47+
server-password: MAVEN_PASSWORD
48+
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
49+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
50+
3851
- name: Publish package
3952
run: mvn -B clean deploy -DskipTests -Prelease
4053
env:
4154
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
4255
MAVEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
4356
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
4457
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSPHRASE }}
58+
59+
publish_gh_pages:
60+
runs-on: ubuntu-latest
61+
needs: build
62+
if: ${{ github.ref == 'refs/heads/release/v1.x' }}
63+
steps:
64+
- uses: actions/checkout@v4
65+
with:
66+
fetch-depth: 0
67+
68+
- uses: actions/download-artifact@v4
69+
with:
70+
name: maven-release-target-directory
71+
path: target
72+
73+
- name: Checkout GH Pages
74+
run: |
75+
git checkout -B gh-pages origin/gh-pages
76+
find . -type f -and -not -path './target/*' -and -not -path './.*' -and -not -name CNAME -delete
77+
cp -r ./target/site/* ./
78+
79+
- name: Publish GH Pages
80+
uses: stefanzweifel/git-auto-commit-action@v5
81+
with:
82+
commit_message: "Release (${{ github.actor }}): v${{ steps.release.outputs.version }}"
83+
branch: gh-pages
84+

0 commit comments

Comments
 (0)