Skip to content

Commit 68672d4

Browse files
committed
feat: added publishing and workflows
1 parent cc98860 commit 68672d4

5 files changed

Lines changed: 126 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build Application
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: 'temurin'
23+
java-version: 17
24+
25+
- name: Grant permissions
26+
run: chmod +x ./gradlew
27+
28+
- name: Cache Gradle dependencies
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.gradle/caches
32+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
33+
restore-keys: |
34+
${{ runner.os }}-gradle-
35+
36+
- name: Build with Gradle
37+
run: ./gradlew build
38+
39+
- name: Upload build artifacts
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: all-modules
43+
path: '**/build/libs/*.jar'

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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: ~/.gradle/caches
29+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
30+
restore-keys: |
31+
${{ runner.os }}-gradle-
32+
33+
- name: Build and publish
34+
run: ./gradlew publish
35+
env:
36+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
37+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Basics
2+
3+
The Basics library provides various small utilities that may be useful in your work.
4+

build.gradle.kts

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

@@ -11,6 +12,15 @@ allprojects {
1112
subprojects {
1213
apply {
1314
plugin("java-library")
15+
plugin("maven-publish")
16+
}
17+
18+
java {
19+
toolchain {
20+
languageVersion = JavaLanguageVersion.of(17)
21+
}
22+
withSourcesJar()
23+
withJavadocJar()
1424
}
1525

1626
repositories {
@@ -22,4 +32,35 @@ subprojects {
2232
compileOnlyApi("org.projectlombok:lombok:1.18.38")
2333
annotationProcessor("org.projectlombok:lombok:1.18.38")
2434
}
35+
36+
publishing {
37+
publications {
38+
create<MavenPublication>("maven") {
39+
groupId = project.group.toString()
40+
artifactId = project.name.lowercase()
41+
version = project.version.toString()
42+
from(components["java"])
43+
}
44+
}
45+
repositories {
46+
maven {
47+
name = "luminiadev"
48+
url = uri("https://repo.luminiadev.com/snapshots")
49+
credentials {
50+
username = System.getenv("MAVEN_USERNAME")
51+
password = System.getenv("MAVEN_PASSWORD")
52+
}
53+
}
54+
}
55+
}
56+
57+
tasks.withType<Javadoc> {
58+
isFailOnError = false
59+
options.encoding = "UTF-8"
60+
(options as StandardJavadocDocletOptions).apply {
61+
addBooleanOption("Xdoclint:none", true)
62+
addStringOption("encoding", "UTF-8")
63+
addStringOption("charSet", "UTF-8")
64+
}
65+
}
2566
}

settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
rootProject.name = "basics"
2-
include("common")
3-
include("nukkit")
2+
include("common")

0 commit comments

Comments
 (0)