-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.95 KB
/
Copy pathrelease.yml
File metadata and controls
61 lines (52 loc) · 1.95 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
name: Release to Maven Central
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Set Release Version
run: |
VERSION=${{ github.event.release.tag_name }}
VERSION=${VERSION#v} # Remove 'v' prefix if present
mvn versions:set -DnewVersion=${VERSION} -DgenerateBackupPoms=false
- name: Publish to Central
run: mvn clean deploy -P release -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Update to Next Snapshot
run: |
# Increment patch version with SNAPSHOT for next development iteration
CURRENT_VERSION=${{ github.event.release.tag_name }}
VERSION=${CURRENT_VERSION#v} # Remove 'v' prefix if present
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3)
NEXT_PATCH=$((PATCH + 1))
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT"
mvn versions:set -DnewVersion=${NEXT_VERSION} -DgenerateBackupPoms=false
git config user.name github-actions
git config user.email github-actions@github.com
git add pom.xml */pom.xml
git commit -m "Prepare next development iteration [skip ci]"
git push