Skip to content

Commit c54506a

Browse files
author
m.r
committed
add GitHub publish gradle
1 parent 6fd9e08 commit c54506a

File tree

2 files changed

+98
-1
lines changed

2 files changed

+98
-1
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
2626

2727
- name: Build with Gradle
28-
run: ./gradlew build
28+
run: ./gradlew -b build-github.gradle build
2929

3030
- name: Upload build artifacts
3131
uses: actions/upload-artifact@v4

build-github.gradle

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
plugins {
2+
id 'java-library'
3+
id 'maven-publish'
4+
5+
}
6+
compileJava {
7+
options.encoding = "UTF-8"
8+
}
9+
compileTestJava {options.encoding = "UTF-8"}
10+
11+
12+
group = 'io.github.mohammadrezaeicode'
13+
version = '0.1-SNAPSHOT'
14+
15+
java {
16+
withJavadocJar()
17+
withSourcesJar()
18+
}
19+
20+
repositories {
21+
mavenCentral()
22+
}
23+
24+
dependencies {
25+
testImplementation platform('org.junit:junit-bom:5.9.1')
26+
testImplementation 'org.junit.jupiter:junit-jupiter'
27+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
28+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
29+
compileOnly 'org.projectlombok:lombok:1.18.36'
30+
annotationProcessor 'org.projectlombok:lombok:1.18.36'
31+
}
32+
33+
publishing {
34+
publications {
35+
gpr(MavenPublication) {
36+
artifactId = "excel"
37+
from components.java
38+
versionMapping {
39+
usage('java-api') {
40+
fromResolutionOf('runtimeClasspath')
41+
}
42+
usage('java-runtime') {
43+
fromResolutionResult()
44+
}
45+
}
46+
pom {
47+
name = 'MR Excel'
48+
description = 'A versatile Java library for effortlessly generating .xlsx files from input objects. Seamlessly create Excel spreadsheets with data, formatting, formulas, and more.'
49+
url = 'https://github.com/mohammadrezaeicode/mr-excel-java'
50+
// properties = [
51+
// myProp: "value",
52+
// "prop.with.dots": "anotherValue"
53+
// ]
54+
licenses {
55+
license {
56+
name = 'The Apache License, Version 2.0'
57+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
58+
}
59+
}
60+
developers {
61+
developer {
62+
id = 'MohammadR'
63+
name = 'Mohammad Rezaei'
64+
65+
}
66+
}
67+
scm {
68+
connection = 'scm:git:https://github.com/mohammadrezaeicode/mr-excel-java.git'
69+
developerConnection = 'scm:git:[email protected]:mohammadrezaeicode/mr-excel-java.git'
70+
url = 'https://github.com/mohammadrezaeicode/mr-excel-java'
71+
}
72+
repositories {
73+
maven {
74+
name = "GitHubPackages"
75+
url = uri("https://maven.pkg.github.com/mohammadrezaeicode/mr-excel-java") // replace OWNER and REPOSITORY with your GitHub username and your repository name
76+
credentials {
77+
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
78+
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
79+
}
80+
}
81+
}
82+
}
83+
}
84+
}
85+
}
86+
87+
test {
88+
useJUnitPlatform()
89+
}
90+
tasks.withType(JavaCompile) {
91+
options.encoding = 'UTF-8'
92+
}
93+
javadoc {
94+
if(JavaVersion.current().isJava9Compatible()) {
95+
options.addBooleanOption('html5', true)
96+
}
97+
}

0 commit comments

Comments
 (0)