Skip to content

Commit 3e2b90d

Browse files
committed
Added new Maven central publication workflow.
1 parent 8fe91a1 commit 3e2b90d

File tree

2 files changed

+129
-8
lines changed

2 files changed

+129
-8
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release To Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseversion:
7+
description: 'Release version'
8+
required: true
9+
default: '0.3.1'
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}"
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up settings.xml for Maven Central Repository
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 8
21+
server-id: oss.sonatype.org
22+
server-username: MAVEN_USERNAME
23+
server-password: MAVEN_PASSWORD
24+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
25+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
26+
27+
- name: Set projects Maven version to GitHub Action GUI set version
28+
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
29+
30+
- name: Publish package
31+
run: mvn --batch-mode clean deploy --no-transfer-progress -P pack-all,maven-release -DskipTests=true
32+
env:
33+
MAVEN_USERNAME: ${{ secrets.MAVEN_USER }}
34+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }}
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
36+
37+
- name: Generate changelog
38+
id: changelog
39+
uses: metcalfc/changelog-generator@v1.0.0
40+
with:
41+
myToken: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Create GitHub Release
44+
id: create_release
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: v${{ github.event.inputs.releaseversion }}
50+
release_name: Stable Release v${{ github.event.inputs.releaseversion }}
51+
body: |
52+
Stable Release v${{ github.event.inputs.releaseversion }}
53+
54+
${{ steps.changelog.outputs.changelog }}
55+
draft: true
56+
prerelease: false

pom.xml

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,21 @@
3535
</scm>
3636
<distributionManagement>
3737
<repository>
38-
<id>bintray-amavashev2-jkoolcloud</id>
39-
<name>amavashev2-jkoolcloud</name>
40-
<url>https://api.bintray.com/maven/amavashev2/jkoolcloud/jkool-client-api/;publish=1;override=1;</url>
38+
<id>oss.sonatype.org</id>
39+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
4140
</repository>
41+
<snapshotRepository>
42+
<id>github</id>
43+
<name>GitHub Nastel Apache Maven Packages</name>
44+
<url>https://maven.pkg.github.com/Nastel/jkool-client-java-api</url>
45+
</snapshotRepository>
4246
</distributionManagement>
4347

4448
<properties>
4549
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
4650
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
51+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
52+
<project.resources.encoding>UTF-8</project.resources.encoding>
4753
<product.vendor>jKool, LLC</product.vendor>
4854

4955
<project.java.version>1.8</project.java.version>
@@ -55,7 +61,7 @@
5561
<java.compiler.fork>false</java.compiler.fork>
5662

5763
<release.deploy.name>${project.artifactId}</release.deploy.name>
58-
<release.deploy.dir>../build/${release.deploy.name}</release.deploy.dir>
64+
<release.deploy.dir>build/</release.deploy.dir>
5965
<release.deploy.finalName>${release.deploy.name}-${project.version}</release.deploy.finalName>
6066
<release.deploy.zip.assembly>src/assembly/zipDeployAssembly.xml</release.deploy.zip.assembly>
6167
<release.deploy.gz.assembly>src/assembly/gzDeployAssembly.xml</release.deploy.gz.assembly>
@@ -76,24 +82,24 @@
7682
<dependency>
7783
<groupId>com.fasterxml.jackson.datatype</groupId>
7884
<artifactId>jackson-datatype-joda</artifactId>
79-
<version>2.11.3</version>
85+
<version>2.12.2</version>
8086
</dependency>
8187
<!-- https://mvnrepository.com/artifact/org.jboss.resteasy/resteasy-client -->
8288
<dependency>
8389
<groupId>org.jboss.resteasy</groupId>
8490
<artifactId>resteasy-client</artifactId>
85-
<version>4.5.8.Final</version>
91+
<version>4.6.0.Final</version>
8692
</dependency>
8793
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
8894
<dependency>
8995
<groupId>io.swagger.core.v3</groupId>
9096
<artifactId>swagger-annotations</artifactId>
91-
<version>2.1.5</version>
97+
<version>2.1.7</version>
9298
</dependency>
9399
<dependency>
94100
<groupId>org.glassfish.tyrus</groupId>
95101
<artifactId>tyrus-container-grizzly-client</artifactId>
96-
<version>1.17</version>
102+
<version>2.0.0</version>
97103
</dependency>
98104
<!-- https://mvnrepository.com/artifact/org.glassfish/javax.json -->
99105
<dependency>
@@ -130,6 +136,12 @@
130136
<assembly.skipAssembly>false</assembly.skipAssembly>
131137
</properties>
132138
</profile>
139+
<profile>
140+
<id>maven-release</id>
141+
<properties>
142+
<gpg.skip>false</gpg.skip>
143+
</properties>
144+
</profile>
133145
</profiles>
134146

135147
<build>
@@ -148,6 +160,14 @@
148160
<fork>${java.compiler.fork}</fork>
149161
</configuration>
150162
</plugin>
163+
<plugin>
164+
<groupId>org.apache.maven.plugins</groupId>
165+
<artifactId>maven-resources-plugin</artifactId>
166+
<version>3.2.0</version>
167+
<configuration>
168+
<encoding>${project.resources.encoding}</encoding>
169+
</configuration>
170+
</plugin>
151171
<plugin>
152172
<groupId>org.apache.maven.plugins</groupId>
153173
<artifactId>maven-source-plugin</artifactId>
@@ -212,6 +232,10 @@
212232
<filesets>
213233
<fileset>
214234
<directory>${release.deploy.dir}</directory>
235+
<includes>
236+
<include>${release.deploy.finalName}/</include>
237+
<include>${release.deploy.finalName}.*</include>
238+
</includes>
215239
</fileset>
216240
</filesets>
217241
</configuration>
@@ -230,6 +254,8 @@
230254
<Implementation-Vendor>${product.vendor}</Implementation-Vendor>
231255
<Implementation-Title>${project.name}</Implementation-Title>
232256
<Implementation-Version>${project.version}-${maven.build.timestamp}</Implementation-Version>
257+
<X-Compile-Source-JDK>${java.source.version}</X-Compile-Source-JDK>
258+
<X-Compile-Target-JDK>${java.target.version}</X-Compile-Target-JDK>
233259
<Main-Class>com.jkoolcloud.client.api.utils.JKQLCmd</Main-Class>
234260
</manifestEntries>
235261
</archive>
@@ -239,6 +265,12 @@
239265
<groupId>org.apache.maven.plugins</groupId>
240266
<artifactId>maven-gpg-plugin</artifactId>
241267
<version>1.6</version>
268+
<configuration>
269+
<gpgArguments>
270+
<arg>--pinentry-mode</arg>
271+
<arg>loopback</arg>
272+
</gpgArguments>
273+
</configuration>
242274
<executions>
243275
<execution>
244276
<id>sign-artifacts</id>
@@ -253,6 +285,39 @@
253285
<groupId>org.apache.maven.plugins</groupId>
254286
<artifactId>maven-deploy-plugin</artifactId>
255287
<version>2.8.2</version>
288+
<configuration>
289+
<skip>true</skip>
290+
</configuration>
291+
</plugin>
292+
<plugin>
293+
<groupId>org.sonatype.plugins</groupId>
294+
<artifactId>nexus-staging-maven-plugin</artifactId>
295+
<version>1.6.8</version>
296+
<extensions>true</extensions>
297+
<configuration>
298+
<serverId>oss.sonatype.org</serverId>
299+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
300+
<!--<description>${project.version}</description>-->
301+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
302+
</configuration>
303+
<executions>
304+
<execution>
305+
<id>deploy-to-sonatype</id>
306+
<phase>deploy</phase>
307+
<goals>
308+
<goal>deploy</goal>
309+
<!--<goal>release</goal>-->
310+
</goals>
311+
</execution>
312+
</executions>
313+
</plugin>
314+
<plugin>
315+
<groupId>org.codehaus.mojo</groupId>
316+
<artifactId>versions-maven-plugin</artifactId>
317+
<version>2.8.1</version>
318+
<configuration>
319+
<generateBackupPoms>false</generateBackupPoms>
320+
</configuration>
256321
</plugin>
257322
</plugins>
258323
</build>

0 commit comments

Comments
 (0)