Skip to content

Commit f1569ab

Browse files
authored
Create release workflow (#44)
* add release workflow * clean up * specifiy release profile * not necessary to exclude maven deploy plugin * validate branch & use release plugin * skip maven gpg plugin * remove v prefix * fix pom & add setting ossrh secrets on java setup
1 parent f7377b2 commit f1569ab

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release maven package
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
release_maven_package:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Validate branch
10+
if: ${{ github.ref != 'refs/heads/master' }}
11+
run: |
12+
echo "Release can only be triggered from master branch"
13+
exit 1
14+
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up jdk
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: 'corretto'
21+
java-version: '8'
22+
server-id: sonatype-nexus-staging
23+
server-username: ${{ secrets.OSSRH_USERNAME }}
24+
server-password: ${{ secrets.OSSRH_PASSWORD }}
25+
26+
- name: Maven release
27+
run: |
28+
mvn \
29+
-B \
30+
-P release \
31+
release:clean \
32+
release:perform \
33+
release:prepare
34+
env:
35+
SIGN_KEY: ${{ secrets.SIGN_KEY }}
36+
SIGN_KEY_ID: ${{ secrets.SIGN_KEY_ID }}
37+
SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }}

pom.xml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4848
<maven.compiler.source>1.8</maven.compiler.source>
4949
<maven.compiler.target>1.8</maven.compiler.target>
50+
<ossrh.id>sonatype-nexus-staging</ossrh.id>
51+
<ossrh.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</ossrh.url>
5052
</properties>
5153

5254
<distributionManagement>
@@ -56,9 +58,9 @@
5658
<url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
5759
</snapshotRepository>
5860
<repository>
59-
<id>sonatype-nexus-staging</id>
61+
<id>${ossrh.id}</id>
6062
<name>Nexus Release Repository</name>
61-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
63+
<url>${ossrh.url}</url>
6264
</repository>
6365
</distributionManagement>
6466

@@ -116,9 +118,6 @@
116118
<plugin>
117119
<groupId>org.apache.maven.plugins</groupId>
118120
<artifactId>maven-release-plugin</artifactId>
119-
<configuration>
120-
<tagNameFormat>v@{project.version}</tagNameFormat>
121-
</configuration>
122121
</plugin>
123122
<plugin>
124123
<groupId>org.apache.maven.plugins</groupId>
@@ -179,18 +178,31 @@
179178
<artifactId>maven-gpg-plugin</artifactId>
180179
<version>1.6</version>
181180
<configuration>
182-
<keyname>B1606F22</keyname>
181+
<skip>true</skip>
183182
</configuration>
183+
</plugin>
184+
<plugin>
185+
<groupId>org.simplify4u.plugins</groupId>
186+
<artifactId>sign-maven-plugin</artifactId>
187+
<version>1.0.1</version>
184188
<executions>
185189
<execution>
186-
<id>sign-artifacts</id>
187-
<phase>verify</phase>
188190
<goals>
189191
<goal>sign</goal>
190192
</goals>
191193
</execution>
192194
</executions>
193195
</plugin>
196+
<plugin>
197+
<groupId>org.sonatype.plugins</groupId>
198+
<artifactId>nexus-staging-maven-plugin</artifactId>
199+
<version>1.6.8</version>
200+
<configuration>
201+
<serverId>${ossrh.id}</serverId>
202+
<nexusUrl>${ossrh.url}</nexusUrl>
203+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
204+
</configuration>
205+
</plugin>
194206
<plugin>
195207
<groupId>org.apache.maven.plugins</groupId>
196208
<artifactId>maven-source-plugin</artifactId>

0 commit comments

Comments
 (0)