-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 1.74 KB
/
ci.yml
File metadata and controls
67 lines (57 loc) · 1.74 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
name: "⚙️ CI & Release Workflow"
on:
push:
pull_request:
types: [ opened, reopened ]
env:
REGISTRY: ghcr.io
JAVA_VERSION: '21'
JAVA_DISTRIBUTION: 'temurin'
permissions:
contents: write
packages: write
jobs:
test:
name: ✅ Run Tests
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v6
- name: ☕ Setup Java ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: "⚡ Setup Gradle with Cache"
uses: gradle/actions/setup-gradle@v5
- name: "🧪 Run Unit Tests"
run: ./gradlew test
releaser:
name: "🏁 Release"
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
runs-on: ubuntu-latest
steps:
- name: "📥 Checkout Code (Full History)"
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: ☕ Setup Java ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: ⚡ Setup Gradle with Cache
uses: gradle/actions/setup-gradle@v5
- name: "🚀 Publish to Maven Central"
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
RAW_TAG="${GITHUB_REF##*/}"
VERSION="${RAW_TAG#v}"
[[ "$VERSION" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
./gradlew publishToCentralPortal -Pversion="$VERSION"