File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed
Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish to Maven Repository
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+
8+ jobs :
9+ build-and-publish :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+
16+ - name : Set up JDK
17+ uses : actions/setup-java@v4
18+ with :
19+ distribution : ' temurin'
20+ java-version : 21
21+
22+ - name : Grant permissions
23+ run : chmod +x ./gradlew
24+
25+ - name : Cache Gradle dependencies
26+ uses : actions/cache@v4
27+ with :
28+ path : |
29+ ~/.gradle/caches
30+ ~/.gradle/wrapper
31+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
32+ restore-keys : |
33+ ${{ runner.os }}-gradle-
34+
35+ - name : Build and publish
36+ run : ./gradlew publish
37+ env :
38+ MAVEN_USERNAME : ${{ secrets.MAVEN_USERNAME }}
39+ MAVEN_PASSWORD : ${{ secrets.MAVEN_PASSWORD }}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
33plugins {
44 java
55 application
6+ `maven- publish`
67 id(" com.gradleup.shadow" ) version " 8.3.6"
78 id(" com.gorylenko.gradle-git-properties" ) version " 2.4.2"
89}
@@ -140,6 +141,27 @@ tasks {
140141 }
141142}
142143
144+ publishing {
145+ publications {
146+ create<MavenPublication >(" maven" ) {
147+ groupId = project.group.toString()
148+ artifactId = project.name
149+ version = project.version.toString()
150+ from(components[" java" ])
151+ }
152+ }
153+ repositories {
154+ maven {
155+ name = " luminiadev"
156+ url = uri(" https://repo.luminiadev.com/snapshots" )
157+ credentials {
158+ username = System .getenv(" MAVEN_USERNAME" )
159+ password = System .getenv(" MAVEN_PASSWORD" )
160+ }
161+ }
162+ }
163+ }
164+
143165gitProperties {
144166 dateFormat = " dd.MM.yyyy '@' HH:mm:ss z"
145167 failOnNoGitDirectory = false
You can’t perform that action at this time.
0 commit comments