1+ name : " ⚙️ CI & Release Workflow"
2+ on :
3+ push :
4+ pull_request :
5+ types : [ opened, reopened ]
6+
7+ env :
8+ JAVA_VERSION : ' 25'
9+ JAVA_DISTRIBUTION : ' temurin'
10+
11+ permissions :
12+ contents : write
13+ packages : write
14+
15+ jobs :
16+ lint :
17+ name : " 🧹 Lint Code"
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : " 📥 Checkout Code (Full History)"
21+ uses : actions/checkout@v5
22+ with :
23+ fetch-depth : 0
24+
25+ - name : " ☕ Setup Java ${{ env.JAVA_VERSION }}"
26+ uses : actions/setup-java@v5
27+ with :
28+ distribution : ${{ env.JAVA_DISTRIBUTION }}
29+ java-version : ${{ env.JAVA_VERSION }}
30+
31+ - name : " ⚡ Setup Gradle with Cache"
32+ uses : gradle/actions/setup-gradle@v5
33+
34+ - name : " 🔍 Run Check"
35+ run : ./gradlew check
36+
37+ test :
38+ name : " ✅ Run Tests"
39+ runs-on : ubuntu-latest
40+ steps :
41+ - name : " 📥 Checkout Code (Full History)"
42+ uses : actions/checkout@v5
43+ with :
44+ fetch-depth : 0
45+
46+ - name : " ☕ Setup Java ${{ env.JAVA_VERSION }}"
47+ uses : actions/setup-java@v5
48+ with :
49+ distribution : ${{ env.JAVA_DISTRIBUTION }}
50+ java-version : ${{ env.JAVA_VERSION }}
51+
52+ - name : " ⚡ Setup Gradle with Cache"
53+ uses : gradle/actions/setup-gradle@v5
54+
55+ - name : " 🧪 Run Unit Tests"
56+ run : ./gradlew test
57+
58+ releaser :
59+ name : " 🏁 Release"
60+ if : startsWith(github.ref, 'refs/tags/')
61+ needs :
62+ - test
63+ - lint
64+ runs-on : ubuntu-latest
65+ steps :
66+ - name : " 📥 Checkout Code (Full History)"
67+ uses : actions/checkout@v5
68+ with :
69+ fetch-depth : 0
70+
71+ - name : " ☕ Setup Java ${{ env.JAVA_VERSION }}"
72+ uses : actions/setup-java@v5
73+ with :
74+ distribution : ${{ env.JAVA_DISTRIBUTION }}
75+ java-version : ${{ env.JAVA_VERSION }}
76+
77+ - name : " ⚡ Setup Gradle with Cache"
78+ uses : gradle/actions/setup-gradle@v5
79+
80+ - name : " 🚀 Publish to Maven Central"
81+ env :
82+ GPG_KEY : ${{ secrets.GPG_KEY }}
83+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
84+ SONATYPE_USERNAME : ${{ secrets.SONATYPE_USERNAME }}
85+ SONATYPE_PASSWORD : ${{ secrets.SONATYPE_PASSWORD }}
86+ run : |
87+ RAW_TAG="${GITHUB_REF##*/}"
88+ VERSION="${RAW_TAG#v}"
89+
90+ [[ "$VERSION" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
91+ ./gradlew publishToCentralPortal -Pversion="$VERSION"
92+
93+ - name : " 📦 Build all shadowJARs"
94+ run : ./gradlew clean shadowJar
95+
96+ - name : " 🚀 Create GitHub Release"
97+ uses : softprops/action-gh-release@v2
98+ with :
99+ files : |
100+ build/libs/*.jar
101+ generate_release_notes : true
0 commit comments