Skip to content

Commit 10a7856

Browse files
Merge 4422374 into 029108b
2 parents 029108b + 4422374 commit 10a7856

File tree

4 files changed

+147
-19
lines changed

4 files changed

+147
-19
lines changed

.github/workflows/maven-merge-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
name: Java CI with Maven
1010

1111
on:
12-
push:
12+
pull_request:
1313
branches: [ "master" ]
1414

1515
jobs:

.github/workflows/publish-central.yml

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,107 @@
11
name: Publish package to the Maven Central Repository
22

33
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
48
release:
59
types: [ published ]
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Version to deploy (optional, will use pom.xml version if not specified)'
14+
required: false
15+
type: string
616

717
jobs:
8-
release:
9-
name: Release on Sonatype OSS
18+
build-and-test:
19+
name: Build and Test
1020
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up JDK 17
28+
uses: actions/setup-java@v4
29+
with:
30+
java-version: 17
31+
distribution: 'temurin'
32+
33+
- name: Cache Maven packages
34+
uses: actions/cache@v3
35+
with:
36+
path: ~/.m2
37+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
38+
restore-keys: ${{ runner.os }}-m2
1139

40+
- name: Build and test
41+
run: mvn -B clean verify
42+
43+
- name: Upload test results
44+
uses: actions/upload-artifact@v3
45+
if: always()
46+
with:
47+
name: test-results
48+
path: target/surefire-reports/
49+
retention-days: 30
50+
51+
- name: Upload coverage reports
52+
uses: actions/upload-artifact@v3
53+
if: always()
54+
with:
55+
name: coverage-reports
56+
path: target/site/jacoco/
57+
retention-days: 30
58+
59+
publish:
60+
name: Publish to Maven Central
61+
runs-on: ubuntu-latest
62+
needs: build-and-test
63+
if: needs.build-and-test.result == 'success' && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
1264
steps:
13-
- uses: actions/checkout@v2
65+
- name: Checkout code
66+
uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 0
1469

1570
- name: Set up JDK 17
16-
uses: actions/setup-java@v2
71+
uses: actions/setup-java@v4
1772
with:
1873
java-version: 17
19-
distribution: 'adopt'
74+
distribution: 'temurin'
2075

21-
- name: Build with Maven
22-
run: mvn -B package --file pom.xml
76+
- name: Cache Maven packages
77+
uses: actions/cache@v3
78+
with:
79+
path: ~/.m2
80+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
81+
restore-keys: ${{ runner.os }}-m2
2382

2483
- name: Set up Apache Maven Central
25-
uses: actions/setup-java@v2
84+
uses: actions/setup-java@v4
2685
with: # running setup-java again overwrites the settings.xml
2786
java-version: 17
28-
distribution: 'adopt'
87+
distribution: 'temurin'
2988
server-id: ossrh
3089
server-username: OSSRH_USERNAME
3190
server-password: OSSRH_PASSWORD
3291
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
3392
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3493

3594
- name: Publish to Apache Maven Central
36-
run: mvn -Prelease deploy
95+
run: mvn -B -Prelease deploy
3796
env:
3897
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3998
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
4099
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
100+
101+
- name: Create Release Tag
102+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
103+
run: |
104+
git config --local user.email "[email protected]"
105+
git config --local user.name "GitHub Action"
106+
git tag -a v${{ github.event.inputs.version }} -m "Release version ${{ github.event.inputs.version }}"
107+
git push origin v${{ github.event.inputs.version }}

.github/workflows/release-build.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# If the PR has the label release:major, release:minor, or release:patch, this will override bump_version_scheme.
22
# https://github.com/marketplace/actions/release-tag-new-action
3-
on:
4-
push:
5-
branches:
6-
- master
3+
on:
4+
pull_request:
5+
branches: [ "master" ]
76

87
jobs:
98
release-on-push:

pom.xml

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.intuit.rwebpulse</groupId>
55
<artifactId>rwebpulse</artifactId>
6-
<version>1.0.3</version>
6+
<version>1.0.4-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<name>Spring Web Client</name>
99
<url>https://github.com/intuit/rwebpulse</url>
@@ -103,6 +103,17 @@
103103

104104
<build>
105105
<plugins>
106+
<plugin>
107+
<groupId>org.sonatype.central</groupId>
108+
<artifactId>central-publishing-maven-plugin</artifactId>
109+
<version>0.8.0</version>
110+
<extensions>true</extensions>
111+
<configuration>
112+
<publishingServerId>central</publishingServerId>
113+
<autoPublish>true</autoPublish>
114+
<waitUntil>published</waitUntil>
115+
</configuration>
116+
</plugin>
106117
<plugin>
107118
<groupId>org.jacoco</groupId>
108119
<artifactId>jacoco-maven-plugin</artifactId>
@@ -123,6 +134,57 @@
123134
</execution>
124135
</executions>
125136
</plugin>
137+
<plugin>
138+
<groupId>org.apache.maven.plugins</groupId>
139+
<artifactId>maven-source-plugin</artifactId>
140+
<version>3.2.1</version>
141+
<executions>
142+
<execution>
143+
<id>attach-sources</id>
144+
<phase>package</phase>
145+
<goals>
146+
<goal>jar-no-fork</goal>
147+
</goals>
148+
</execution>
149+
</executions>
150+
</plugin>
151+
<plugin>
152+
<groupId>org.apache.maven.plugins</groupId>
153+
<artifactId>maven-javadoc-plugin</artifactId>
154+
<version>3.2.0</version>
155+
<executions>
156+
<execution>
157+
<id>attach-javadocs</id>
158+
<phase>package</phase>
159+
<goals>
160+
<goal>jar</goal>
161+
</goals>
162+
</execution>
163+
</executions>
164+
</plugin>
165+
<plugin>
166+
<groupId>org.apache.maven.plugins</groupId>
167+
<artifactId>maven-gpg-plugin</artifactId>
168+
<version>1.6</version>
169+
<executions>
170+
<execution>
171+
<id>sign-artifacts</id>
172+
<phase>verify</phase>
173+
<goals>
174+
<goal>sign</goal>
175+
</goals>
176+
</execution>
177+
</executions>
178+
<configuration>
179+
<gpgArguments>
180+
<arg>--pinentry-mode</arg>
181+
<arg>loopback</arg>
182+
<arg>--batch</arg>
183+
<arg>--yes</arg>
184+
</gpgArguments>
185+
<useAgent>false</useAgent>
186+
</configuration>
187+
</plugin>
126188
</plugins>
127189
<pluginManagement>
128190
<plugins>
@@ -162,7 +224,7 @@
162224
<version>1.6.7</version>
163225
<extensions>true</extensions>
164226
<configuration>
165-
<serverId>ossrh</serverId>
227+
<serverId>central</serverId>
166228
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
167229
<autoReleaseAfterClose>true</autoReleaseAfterClose>
168230
</configuration>
@@ -227,11 +289,11 @@
227289
</profiles>
228290
<distributionManagement>
229291
<snapshotRepository>
230-
<id>ossrh</id>
292+
<id>central</id>
231293
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
232294
</snapshotRepository>
233295
<repository>
234-
<id>ossrh</id>
296+
<id>central</id>
235297
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
236298
</repository>
237299
</distributionManagement>

0 commit comments

Comments
 (0)