Skip to content

Commit 4ddc092

Browse files
committed
feat: support maven deploy
1 parent 9200e62 commit 4ddc092

File tree

12 files changed

+111
-51
lines changed

12 files changed

+111
-51
lines changed

.github/workflows/dev-deploy.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737
run: bun install --frozen-lockfile && bun run build
3838

3939
- name: Build Boot with Gradle
40-
run: ./gradlew -Pversion=dev :boot:bootjar -x test
40+
run: ./gradlew :boot:bootjar -x test
4141

4242
- name: Upload Boot Jar
4343
uses: actions/upload-artifact@v4
4444
with:
4545
name: boot
46-
path: boot/build/libs/boot-dev.jar
46+
path: boot/build/libs/*.jar
4747

4848
docker-push:
4949
name: Docker Push
@@ -78,6 +78,30 @@ jobs:
7878
push: true
7979
tags: docker.io/reajason/memshell-party:dev
8080

81+
deploy-maven:
82+
name: Docker Push
83+
needs: [ build-jar ]
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v4
87+
- name: Setup Java
88+
uses: actions/setup-java@v4
89+
with:
90+
distribution: 'temurin'
91+
java-version: 17
92+
93+
- name: Setup Gradle
94+
uses: gradle/actions/setup-gradle@v4
95+
96+
- name: Publish with Gradle
97+
env:
98+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }}
99+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }}
100+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }}
101+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }}
102+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }}
103+
run: ./gradlew publishAllToMavenCentral
104+
81105
deploy-northflank:
82106
name: Deploy to Northflank
83107
needs: [ docker-push ]

.github/workflows/release.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
run: bun install --frozen-lockfile && bun run build
5959

6060
- name: Build Boot with Gradle
61-
run: ./gradlew -Pversion=${{ needs.info.outputs.version-without-v }} :boot:bootjar -x test
61+
run: ./gradlew :boot:bootjar -x test
6262

6363
- name: Upload Boot Jar
6464
uses: actions/upload-artifact@v4
@@ -125,18 +125,13 @@ jobs:
125125
name: boot
126126
path: boot/build/libs
127127

128-
- name: Calculate SHA-256
129-
id: calculate_sha256
130-
run: |
131-
sha256sum boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar > boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.sha256
132-
133128
- name: Release
134129
uses: ncipollo/release-action@v1
135130
with:
136131
name: ${{ needs.info.outputs.version }}
137132
tag: ${{ needs.info.outputs.version }}
138133
body: ${{ needs.info.outputs.changelog }}
139-
artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar,boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.sha256
134+
artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar
140135

141136
deploy-northflank:
142137
name: Deploy to Northflank

build.gradle

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,59 @@
1-
version = project.getProperties().get("version") != "unspecified" ? version : '1.0.0'
1+
import com.vanniktech.maven.publish.SonatypeHost
2+
3+
version = '1.6.1-SNAPSHOT'
4+
5+
buildscript {
6+
repositories {
7+
mavenCentral()
8+
gradlePluginPortal()
9+
}
10+
dependencies {
11+
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.31.0'
12+
classpath "io.freefair.lombok:io.freefair.lombok.gradle.plugin:8.13.1"
13+
}
14+
}
215

316
allprojects {
4-
if (it.name != 'bom') {
17+
group = 'io.github.reajason'
18+
19+
if (it.name != 'memshell-party-bom') {
520
apply(plugin: 'java')
621
apply(plugin: 'idea')
722
apply(plugin: 'jacoco')
23+
apply(plugin: 'io.freefair.lombok')
24+
}
25+
26+
apply(plugin: 'com.vanniktech.maven.publish')
27+
28+
mavenPublishing {
29+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
30+
signAllPublications()
31+
coordinates("io.github.reajason", project.name, rootProject.version as String)
32+
33+
pom {
34+
name = 'MemShellParty'
35+
description = project.description
36+
url = 'https://github.com/ReaJason/MemShellParty'
37+
inceptionYear = '2025'
38+
licenses {
39+
license {
40+
name = 'MIT'
41+
url = 'https://spdx.org/licenses/MIT.html'
42+
}
43+
}
44+
developers {
45+
developer {
46+
id = 'reajason'
47+
name = 'ReaJason'
48+
url = "https://reajason.eu.org"
49+
}
50+
}
51+
scm {
52+
connection = 'scm:git:https://github.com/ReaJason/MemShellParty.git'
53+
developerConnection = 'scm:git:ssh://github.com/ReaJason/MemShellParty.git'
54+
url = 'https://github.com/ReaJason/MemShellParty'
55+
}
56+
}
857
}
958

1059
if (it.name != 'memshell-party-bom' && !it.name.startsWith("vul")) {
@@ -48,4 +97,23 @@ jacocoTestReport {
4897
}
4998
)
5099
}
100+
}
101+
102+
tasks.register('publishAllToMavenCentral') {
103+
def isSnapshot = rootProject.version.toString().endsWith('-SNAPSHOT')
104+
if (isSnapshot) {
105+
dependsOn ':memshell-party-bom:publishAllPublicationsToMavenCentralRepository'
106+
dependsOn ':memshell-party-common:publishAllPublicationsToMavenCentralRepository'
107+
dependsOn ':deserialize:publishAllPublicationsToMavenCentralRepository'
108+
dependsOn ':memshell:publishAllPublicationsToMavenCentralRepository'
109+
dependsOn ':memshell-java8:publishAllPublicationsToMavenCentralRepository'
110+
dependsOn ':generator:publishAllPublicationsToMavenCentralRepository'
111+
} else {
112+
dependsOn ':memshell-party-bom:publishAndReleaseToMavenCentral'
113+
dependsOn ':memshell-party-common:publishAndReleaseToMavenCentral'
114+
dependsOn ':deserialize:publishAndReleaseToMavenCentral'
115+
dependsOn ':memshell:publishAndReleaseToMavenCentral'
116+
dependsOn ':memshell-java8:publishAndReleaseToMavenCentral'
117+
dependsOn ':generator:publishAndReleaseToMavenCentral'
118+
}
51119
}

deserialize/build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
plugins {
2-
id "io.freefair.lombok" version "8.11"
3-
}
4-
5-
group = 'com.reajason.javaweb'
1+
group = 'io.github.reajason'
2+
description = "Java deserialize payload for MemShellParty"
63
version = rootProject.version
74

85
dependencies {

generator/build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
plugins {
2-
id "io.freefair.lombok" version "8.11"
3-
}
4-
51
java {
62
toolchain {
73
languageVersion = JavaLanguageVersion.of(8)
@@ -10,9 +6,11 @@ java {
106
targetCompatibility = JavaVersion.VERSION_1_8
117
}
128

13-
group = 'com.reajason.javaweb'
9+
group = 'io.github.reajason'
10+
description = "MemShell Generator for Java"
1411
version = rootProject.version
1512

13+
// 测试使用 JDK17 进行编译与运行
1614
tasks.withType(Test).configureEach {
1715
javaLauncher = javaToolchains.launcherFor {
1816
languageVersion = JavaLanguageVersion.of(17)

integration-test/build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
plugins {
2-
id "io.freefair.lombok" version "8.11"
3-
}
4-
5-
group = 'com.reajason.javaweb'
1+
group = 'io.github.reajason'
62
version = rootProject.version
73

84
dependencies {
@@ -18,11 +14,9 @@ dependencies {
1814

1915
testImplementation 'javax.servlet:javax.servlet-api'
2016
testImplementation 'javax.websocket:javax.websocket-api'
21-
testImplementation 'jakarta.servlet:jakarta.servlet-api'
2217

2318
testImplementation 'org.java-websocket:Java-WebSocket'
2419
testImplementation 'com.squareup.okhttp3:okhttp'
25-
testImplementation 'com.alibaba.fastjson2:fastjson2'
2620
testImplementation 'org.slf4j:slf4j-simple:2.0.16'
2721

2822
testImplementation platform('org.junit:junit-bom')

memshell-java8/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
group = 'com.reajason.javaweb'
1+
group = 'io.github.reajason'
2+
description = "Normal Java MemShell for Java8"
23
version = rootProject.version
34

45
java {

memshell/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
group = 'com.reajason.javaweb'
1+
group = 'io.github.reajason'
2+
description = "Normal Java MemShell"
23
version = rootProject.version
34

45

tools/ant-sword/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
plugins {
2-
id "io.freefair.lombok" version "8.11"
3-
}
4-
51
group = 'com.reajason.javaweb.tools'
62
version = rootProject.version
73

tools/behinder/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
plugins {
2-
id "io.freefair.lombok" version "8.11"
3-
}
4-
5-
group = 'com.reajason.javaweb.tools'
1+
group = 'io.github.reajason.tools'
62
version = rootProject.version
73

84
java {

0 commit comments

Comments
 (0)