Skip to content

Commit 50047d0

Browse files
committed
ci : Add a pipeline for release to maven central
This is taken from Fabric8 Kubernetes Client release pipeline It would take input of release tag and perform release of project at that specific revision. There are some additional inputs as well with java version and additional_args (for release). Signed-off-by: Rohan Kumar <rohaan@redhat.com>
1 parent af3a6d0 commit 50047d0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release to Maven Central
2+
3+
env:
4+
MAVEN_ARGS: -B -C -V -ntp -Dhttp.keepAlive=false -e ${{ github.event.inputs.additional_args }}
5+
RELEASE_MAVEN_ARGS: -Prelease -DstagingProgressTimeoutMinutes=20
6+
OSSRHUSERNAME: ${{ secrets.OSSRHUSERNAME }}
7+
OSSRHPASSWORD: ${{ secrets.OSSRHPASSWORD }}
8+
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
9+
10+
on:
11+
workflow_dispatch:
12+
input:
13+
tag:
14+
description: Tag to release
15+
required: true
16+
additional_args:
17+
description: Additional Maven Args
18+
required: false
19+
default: ''
20+
java_distribution:
21+
description: Java Distribution to use for release
22+
required: true
23+
default: 'temurin'
24+
25+
jobs:
26+
release:
27+
name: Release to maven central
28+
# Cheap way to prevent accidental releases
29+
# Modify the list to add users with release permissions
30+
if: contains('["rhuss","rohanKanojia"]', github.actor)
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ github.event.inputs.tag }}
37+
- name: Setup Java
38+
uses: actions/setup-java@v4
39+
with:
40+
java-version: 11
41+
distribution: ${{ github.event.inputs.java_distribution }}
42+
server-id: sonatype-nexus-staging
43+
server-username: OSSRHUSERNAME
44+
server-password: OSSRHPASSWORD
45+
gpg-private-key: ${{ secrets.SIGNINGKEY }}
46+
gpg-passphrase: SIGNINGPASSWORD
47+
- name: Build and Release Project
48+
run: ./mvnw ${MAVEN_ARGS} ${RELEASE_MAVEN_ARGS} clean deploy

0 commit comments

Comments
 (0)