Skip to content

Commit 471909c

Browse files
authored
ci: improve build & docs action and implement publish one for release (#42)
* ci: improve build / docs workflows actions and add publish action * ci: no need to execute test on deploy action
1 parent ea09bfc commit 471909c

File tree

5 files changed

+82
-45
lines changed

5 files changed

+82
-45
lines changed

.github/workflows/build.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- master
77
push:
8+
branches:
9+
- master
810

911
jobs:
1012
build:
@@ -25,4 +27,4 @@ jobs:
2527
with:
2628
java-version: ${{ matrix.java }}
2729
- name: Build with Maven
28-
run: mvn -B package --file pom.xml -P release
30+
run: mvn -B package -P !build-extras -Dmaven.javadoc.skip=true --file pom.xml

.github/workflows/docs.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
name: Docs
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
74
push:
85
branches:
96
- master
10-
# Disabled until docs support versioning per branch/release
11-
# - develop
7+
release:
8+
types:
9+
- published
1210

1311
jobs:
1412
docs:

.github/workflows/publish.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Maven Central Repository
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 1.8
15+
server-id: ossrh
16+
server-username: MAVEN_USERNAME
17+
server-password: MAVEN_PASSWORD
18+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
19+
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
20+
- name: Publish package
21+
run: mvn -P sign,build-extras clean deploy -DskipTests
22+
env:
23+
MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
24+
MAVEN_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
25+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/release-drafter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
# branches to consider in the event; optional, defaults to all
66
branches:
7-
- develop
7+
- master
88

99
jobs:
1010
update_release_draft:

pom.xml

+50-38
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151
<id>ossrh</id>
5252
<url>https://aws.oss.sonatype.org/content/repositories/snapshots</url>
5353
</snapshotRepository>
54-
<repository>
55-
<id>ossrh</id>
56-
<url>https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
57-
</repository>
5854
</distributionManagement>
5955

6056
<dependencies>
@@ -215,23 +211,6 @@
215211
</execution>
216212
</executions>
217213
</plugin>
218-
<plugin>
219-
<groupId>org.apache.maven.plugins</groupId>
220-
<artifactId>maven-javadoc-plugin</artifactId>
221-
<version>2.9.1</version>
222-
<configuration>
223-
<additionalparam>-Xdoclint:none</additionalparam>
224-
<detectJavaApiLink>false</detectJavaApiLink>
225-
</configuration>
226-
<executions>
227-
<execution>
228-
<id>attach-javadocs</id>
229-
<goals>
230-
<goal>jar</goal>
231-
</goals>
232-
</execution>
233-
</executions>
234-
</plugin>
235214
<plugin>
236215
<groupId>org.codehaus.mojo</groupId>
237216
<artifactId>cobertura-maven-plugin</artifactId>
@@ -244,51 +223,84 @@
244223
<check />
245224
</configuration>
246225
</plugin>
226+
<plugin>
227+
<groupId>org.sonatype.plugins</groupId>
228+
<artifactId>nexus-staging-maven-plugin</artifactId>
229+
<version>1.6.8</version>
230+
<extensions>true</extensions>
231+
<configuration>
232+
<serverId>sonatype-nexus-staging</serverId>
233+
<nexusUrl>https://aws.oss.sonatype.org</nexusUrl>
234+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
235+
</configuration>
236+
</plugin>
247237
</plugins>
248238
</build>
249239

250240
<profiles>
251241
<profile>
252-
<id>release</id>
242+
<id>sign</id>
253243
<build>
254244
<plugins>
255245
<plugin>
256246
<groupId>org.apache.maven.plugins</groupId>
257-
<artifactId>maven-source-plugin</artifactId>
258-
<version>2.2.1</version>
247+
<artifactId>maven-gpg-plugin</artifactId>
248+
<version>1.6</version>
259249
<executions>
260250
<execution>
261-
<id>attach-sources</id>
251+
<id>sign-artifacts</id>
252+
<phase>verify</phase>
262253
<goals>
263-
<goal>jar-no-fork</goal>
254+
<goal>sign</goal>
264255
</goals>
256+
<configuration>
257+
<gpgArguments>
258+
<arg>--pinentry-mode</arg>
259+
<arg>loopback</arg>
260+
</gpgArguments>
261+
</configuration>
265262
</execution>
266263
</executions>
267264
</plugin>
265+
</plugins>
266+
</build>
267+
</profile>
268+
<profile>
269+
<id>build-extras</id>
270+
<activation>
271+
<activeByDefault>true</activeByDefault>
272+
</activation>
273+
<build>
274+
<plugins>
268275
<plugin>
269276
<groupId>org.apache.maven.plugins</groupId>
270-
<artifactId>maven-gpg-plugin</artifactId>
271-
<version>1.6</version>
277+
<artifactId>maven-source-plugin</artifactId>
278+
<version>2.4</version>
272279
<executions>
273280
<execution>
274-
<id>sign-artifacts</id>
275-
<phase>verify</phase>
281+
<id>attach-sources</id>
276282
<goals>
277-
<goal>sign</goal>
283+
<goal>jar-no-fork</goal>
278284
</goals>
279285
</execution>
280286
</executions>
281287
</plugin>
282288
<plugin>
283-
<groupId>org.sonatype.plugins</groupId>
284-
<artifactId>nexus-staging-maven-plugin</artifactId>
285-
<version>1.6.8</version>
286-
<extensions>true</extensions>
289+
<groupId>org.apache.maven.plugins</groupId>
290+
<artifactId>maven-javadoc-plugin</artifactId>
291+
<version>2.10.3</version>
287292
<configuration>
288-
<serverId>sonatype-nexus-staging</serverId>
289-
<nexusUrl>https://aws.oss.sonatype.org</nexusUrl>
290-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
293+
<additionalparam>-Xdoclint:none</additionalparam>
294+
<detectJavaApiLink>false</detectJavaApiLink>
291295
</configuration>
296+
<executions>
297+
<execution>
298+
<id>attach-javadocs</id>
299+
<goals>
300+
<goal>jar</goal>
301+
</goals>
302+
</execution>
303+
</executions>
292304
</plugin>
293305
</plugins>
294306
</build>

0 commit comments

Comments
 (0)