File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish to GitHub Packages
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - release/*
8+
9+ jobs :
10+ publish :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ packages : write
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v5
19+
20+ - name : Set up JDK 21
21+ uses : actions/setup-java@v5
22+ with :
23+ distribution : temurin
24+ java-version : 21
25+
26+ - name : Grant execute permission for Gradle wrapper
27+ run : chmod +x gradlew
28+
29+ - name : Build jar
30+ run : ./gradlew clean build
31+
32+ - name : Publish to GitHub Packages
33+ env :
34+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+ run : ./gradlew publish
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ plugins {
22 id(" java" )
33 id(" com.gradleup.shadow" ) version " 9.4.1"
44 id(" io.freefair.lombok" ) version " 9.2.0"
5+ id(" maven-publish" )
56}
67
78group = " com.craftlyworks.mininggame.helper"
@@ -45,4 +46,33 @@ tasks {
4546 build {
4647 dependsOn(shadowJar)
4748 }
49+ }
50+
51+
52+ java {
53+ toolchain {
54+ languageVersion.set(JavaLanguageVersion .of(21 ))
55+ }
56+ withSourcesJar()
57+ withJavadocJar()
58+ }
59+
60+ publishing {
61+ publications {
62+ create<MavenPublication >(" mavenJava" ) {
63+ from(components[" java" ])
64+ artifactId = " mininghelper"
65+ }
66+ }
67+ repositories {
68+ mavenLocal()
69+ maven {
70+ name = " GitHubPackages"
71+ url = uri(" https://maven.pkg.github.com/CraftlyWorks/mininghelper" )
72+ credentials {
73+ username = System .getenv(" GITHUB_ACTOR" ) ? : " CraftlyWorks"
74+ password = System .getenv(" GITHUB_TOKEN" ) ? : System .getenv(" GITHUB_PAT" )
75+ }
76+ }
77+ }
4878}
You can’t perform that action at this time.
0 commit comments