Skip to content

Commit b9b65d7

Browse files
authored
Merge pull request #8 from LuminiaDev/publish
feat: maven publishing
2 parents 785bf9b + be53ccc commit b9b65d7

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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: 17
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 }}

build.gradle.kts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
`java-library`
3+
`maven-publish`
34
id("java")
45
}
56

@@ -10,7 +11,7 @@ java {
1011
}
1112

1213
allprojects {
13-
group = "com.luminia"
14+
group = "com.luminiadev"
1415
version = "1.0.6-SNAPSHOT"
1516
}
1617

@@ -29,4 +30,25 @@ subprojects {
2930
api("org.projectlombok:lombok:1.18.36")
3031
annotationProcessor("org.projectlombok:lombok:1.18.36")
3132
}
33+
34+
publishing {
35+
publications {
36+
create<MavenPublication>("maven") {
37+
groupId = project.group.toString()
38+
artifactId = project.name
39+
version = project.version.toString()
40+
from(components["java"])
41+
}
42+
}
43+
repositories {
44+
maven {
45+
name = "luminiadev"
46+
url = uri("https://repo.luminiadev.com/snapshots")
47+
credentials {
48+
username = System.getenv("MAVEN_USERNAME")
49+
password = System.getenv("MAVEN_PASSWORD")
50+
}
51+
}
52+
}
53+
}
3254
}

0 commit comments

Comments
 (0)