-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.2 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (67 loc) · 2.2 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.1)'
required: true
type: string
permissions:
contents: write
jobs:
release:
name: Release to Maven Central
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v7
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Set Version if manual
if: github.event_name == 'workflow_dispatch'
run: |
VERSION="${{ inputs.version }}"
# Strip 'v' prefix if provided (for Maven)
MAVEN_VERSION="${VERSION#v}"
./mvnw versions:set -DnewVersion=$MAVEN_VERSION -DgenerateBackupPoms=false
- name: Build and Deploy
run: ./mvnw clean deploy -Prelease --batch-mode --no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Determine Tag Name
id: get_tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
if [[ $VERSION != v* ]]; then
TAG_NAME="v$VERSION"
else
TAG_NAME="$VERSION"
fi
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "release_name=Release $TAG_NAME" >> $GITHUB_OUTPUT
else
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "release_name=Release ${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.get_tag.outputs.tag_name }}
name: ${{ steps.get_tag.outputs.release_name }}
generate_release_notes: true