-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.65 KB
/
release.yml
File metadata and controls
53 lines (48 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Publish Release to Maven Central
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-M[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-RC[0-9]+'
workflow_dispatch:
inputs:
tag:
description: 'Tag to checkout and publish (e.g., 2.0.0, 2.0.0-M1, 2.0.0-RC1)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-20.04-self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ inputs.tag }}
- name: Validate tag format
run: |
TAG="${{ github.ref_name || inputs.tag }}"
if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-M[0-9]+|-RC[0-9]+)?$ ]]; then
echo "Error: Tag '$TAG' does not match valid version pattern"
echo "Expected formats: X.Y.Z, X.Y.Z-MN, or X.Y.Z-RCN"
exit 1
fi
echo "Tag '$TAG' is valid"
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_TOKEN
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Maven Central
run: |
./mvnw -B clean deploy -PsonatypeRelease -DskipTests -pl '!jacoco-coverage-aggregate-report,!documentation'
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER }}
MAVEN_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}