diff --git a/.github/workflows/dev-deploy.yaml b/.github/workflows/dev-deploy.yaml index 2cc9929a..c2c695af 100644 --- a/.github/workflows/dev-deploy.yaml +++ b/.github/workflows/dev-deploy.yaml @@ -37,13 +37,13 @@ jobs: run: bun install --frozen-lockfile && bun run build - name: Build Boot with Gradle - run: ./gradlew -Pversion=dev :boot:bootjar -x test + run: ./gradlew :boot:bootjar -x test - name: Upload Boot Jar uses: actions/upload-artifact@v4 with: name: boot - path: boot/build/libs/boot-dev.jar + path: boot/build/libs/*.jar docker-push: name: Docker Push @@ -78,6 +78,30 @@ jobs: push: true tags: docker.io/reajason/memshell-party:dev + deploy-maven: + name: Docker Push + needs: [ build-jar ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Publish with Gradle + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }} + run: ./gradlew publishAllToMavenCentral + deploy-northflank: name: Deploy to Northflank needs: [ docker-push ] diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 75745ae0..dd806706 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,7 +58,7 @@ jobs: run: bun install --frozen-lockfile && bun run build - name: Build Boot with Gradle - run: ./gradlew -Pversion=${{ needs.info.outputs.version-without-v }} :boot:bootjar -x test + run: ./gradlew :boot:bootjar -x test - name: Upload Boot Jar uses: actions/upload-artifact@v4 @@ -125,18 +125,13 @@ jobs: name: boot path: boot/build/libs - - name: Calculate SHA-256 - id: calculate_sha256 - run: | - sha256sum boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar > boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.sha256 - - name: Release uses: ncipollo/release-action@v1 with: name: ${{ needs.info.outputs.version }} tag: ${{ needs.info.outputs.version }} body: ${{ needs.info.outputs.changelog }} - artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar,boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.sha256 + artifacts: boot/build/libs/boot-${{ needs.info.outputs.version-without-v }}.jar deploy-northflank: name: Deploy to Northflank diff --git a/build.gradle b/build.gradle index 64b7ce37..da0fc453 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,59 @@ -version = project.getProperties().get("version") != "unspecified" ? version : '1.0.0' +import com.vanniktech.maven.publish.SonatypeHost + +version = '1.6.1-SNAPSHOT' + +buildscript { + repositories { + mavenCentral() + gradlePluginPortal() + } + dependencies { + classpath 'com.vanniktech:gradle-maven-publish-plugin:0.31.0' + classpath "io.freefair.lombok:io.freefair.lombok.gradle.plugin:8.13.1" + } +} allprojects { - if (it.name != 'bom') { + group = 'io.github.reajason' + + if (it.name != 'memshell-party-bom') { apply(plugin: 'java') apply(plugin: 'idea') apply(plugin: 'jacoco') + apply(plugin: 'io.freefair.lombok') + } + + apply(plugin: 'com.vanniktech.maven.publish') + + mavenPublishing { + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + signAllPublications() + coordinates("io.github.reajason", project.name, rootProject.version as String) + + pom { + name = 'MemShellParty' + description = project.description + url = 'https://github.com/ReaJason/MemShellParty' + inceptionYear = '2025' + licenses { + license { + name = 'MIT' + url = 'https://spdx.org/licenses/MIT.html' + } + } + developers { + developer { + id = 'reajason' + name = 'ReaJason' + url = "https://reajason.eu.org" + } + } + scm { + connection = 'scm:git:https://github.com/ReaJason/MemShellParty.git' + developerConnection = 'scm:git:ssh://github.com/ReaJason/MemShellParty.git' + url = 'https://github.com/ReaJason/MemShellParty' + } + } } if (it.name != 'memshell-party-bom' && !it.name.startsWith("vul")) { @@ -48,4 +97,23 @@ jacocoTestReport { } ) } +} + +tasks.register('publishAllToMavenCentral') { + def isSnapshot = rootProject.version.toString().endsWith('-SNAPSHOT') + if (isSnapshot) { + dependsOn ':memshell-party-bom:publishAllPublicationsToMavenCentralRepository' + dependsOn ':memshell-party-common:publishAllPublicationsToMavenCentralRepository' + dependsOn ':deserialize:publishAllPublicationsToMavenCentralRepository' + dependsOn ':memshell:publishAllPublicationsToMavenCentralRepository' + dependsOn ':memshell-java8:publishAllPublicationsToMavenCentralRepository' + dependsOn ':generator:publishAllPublicationsToMavenCentralRepository' + } else { + dependsOn ':memshell-party-bom:publishAndReleaseToMavenCentral' + dependsOn ':memshell-party-common:publishAndReleaseToMavenCentral' + dependsOn ':deserialize:publishAndReleaseToMavenCentral' + dependsOn ':memshell:publishAndReleaseToMavenCentral' + dependsOn ':memshell-java8:publishAndReleaseToMavenCentral' + dependsOn ':generator:publishAndReleaseToMavenCentral' + } } \ No newline at end of file diff --git a/deserialize/build.gradle b/deserialize/build.gradle index f200f8d4..24d3e795 100644 --- a/deserialize/build.gradle +++ b/deserialize/build.gradle @@ -1,8 +1,5 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - -group = 'com.reajason.javaweb' +group = 'io.github.reajason' +description = "Java deserialize payload for MemShellParty" version = rootProject.version dependencies { diff --git a/generator/build.gradle b/generator/build.gradle index 9248cea3..fd4a580e 100644 --- a/generator/build.gradle +++ b/generator/build.gradle @@ -1,7 +1,3 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - java { toolchain { languageVersion = JavaLanguageVersion.of(8) @@ -10,9 +6,11 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } -group = 'com.reajason.javaweb' +group = 'io.github.reajason' +description = "MemShell Generator for Java" version = rootProject.version +// 测试使用 JDK17 进行编译与运行 tasks.withType(Test).configureEach { javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(17) diff --git a/integration-test/build.gradle b/integration-test/build.gradle index 752eb538..5f160502 100644 --- a/integration-test/build.gradle +++ b/integration-test/build.gradle @@ -1,8 +1,4 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - -group = 'com.reajason.javaweb' +group = 'io.github.reajason' version = rootProject.version dependencies { @@ -18,11 +14,9 @@ dependencies { testImplementation 'javax.servlet:javax.servlet-api' testImplementation 'javax.websocket:javax.websocket-api' - testImplementation 'jakarta.servlet:jakarta.servlet-api' testImplementation 'org.java-websocket:Java-WebSocket' testImplementation 'com.squareup.okhttp3:okhttp' - testImplementation 'com.alibaba.fastjson2:fastjson2' testImplementation 'org.slf4j:slf4j-simple:2.0.16' testImplementation platform('org.junit:junit-bom') diff --git a/memshell-java8/build.gradle b/memshell-java8/build.gradle index 5cfacb7f..f29a56fc 100644 --- a/memshell-java8/build.gradle +++ b/memshell-java8/build.gradle @@ -1,4 +1,5 @@ -group = 'com.reajason.javaweb' +group = 'io.github.reajason' +description = "Normal Java MemShell for Java8" version = rootProject.version java { diff --git a/memshell/build.gradle b/memshell/build.gradle index 7f9e9bd5..b533fa7f 100644 --- a/memshell/build.gradle +++ b/memshell/build.gradle @@ -1,4 +1,5 @@ -group = 'com.reajason.javaweb' +group = 'io.github.reajason' +description = "Normal Java MemShell" version = rootProject.version diff --git a/tools/ant-sword/build.gradle b/tools/ant-sword/build.gradle index f35685dc..89c5ffe6 100644 --- a/tools/ant-sword/build.gradle +++ b/tools/ant-sword/build.gradle @@ -1,7 +1,3 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - group = 'com.reajason.javaweb.tools' version = rootProject.version diff --git a/tools/behinder/build.gradle b/tools/behinder/build.gradle index a80ce730..3e0ef453 100644 --- a/tools/behinder/build.gradle +++ b/tools/behinder/build.gradle @@ -1,8 +1,4 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - -group = 'com.reajason.javaweb.tools' +group = 'io.github.reajason.tools' version = rootProject.version java { diff --git a/tools/godzilla/build.gradle b/tools/godzilla/build.gradle index 70354b9a..4d1c8b56 100644 --- a/tools/godzilla/build.gradle +++ b/tools/godzilla/build.gradle @@ -1,9 +1,4 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - - -group = 'com.reajason.javaweb.tools' +group = 'io.github.reajason.tools' version = rootProject.version java { diff --git a/tools/suo5/build.gradle b/tools/suo5/build.gradle index 70354b9a..4d1c8b56 100644 --- a/tools/suo5/build.gradle +++ b/tools/suo5/build.gradle @@ -1,9 +1,4 @@ -plugins { - id "io.freefair.lombok" version "8.11" -} - - -group = 'com.reajason.javaweb.tools' +group = 'io.github.reajason.tools' version = rootProject.version java {