From 7794a168f8083b0be102ff87d89bc58d9b55a77a Mon Sep 17 00:00:00 2001 From: gabfssilva Date: Mon, 22 Jan 2024 17:59:58 -0300 Subject: [PATCH] Configure OSX and Windows builds --- .github/workflows/release.yml | 52 +++++++++++++++++- build.gradle.kts | 100 ++++++++++++++++++++++++---------- 2 files changed, 123 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 873049f0..9710bef0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,4 +46,54 @@ jobs: RELEASER_NEXUS2_USERNAME: ${{ secrets.RELEASER_NEXUS2_USERNAME }} RELEASER_NEXUS2_PASSWORD: ${{ secrets.RELEASER_NEXUS2_PASSWORD }} with: - arguments: assemble sourcesJar javadocJar signAllPublications publish --stacktrace + arguments: assemble sourcesJar javadocJar signAllPublications publishJvmArtifacts publishLinuxArtifacts publishJsArtifacts --stacktrace + + windows-release: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Assembly + uses: gradle/gradle-build-action@v2 + with: + arguments: assemble sourcesJar javadocJar --parallel --stacktrace + + - name: Sign & publish to Maven Central + uses: gradle/gradle-build-action@v2 + env: + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_SECRET_FILE: ${{ secrets.SIGNING_SECRET_FILE }} + RELEASER_NEXUS2_USERNAME: ${{ secrets.RELEASER_NEXUS2_USERNAME }} + RELEASER_NEXUS2_PASSWORD: ${{ secrets.RELEASER_NEXUS2_PASSWORD }} + with: + arguments: assemble sourcesJar javadocJar publishWindowsArtifacts publish --stacktrace + + macos-release: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Assembly + uses: gradle/gradle-build-action@v2 + with: + arguments: assemble sourcesJar javadocJar --parallel --stacktrace + + - name: Sign & publish to Maven Central + uses: gradle/gradle-build-action@v2 + env: + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_SECRET_FILE: ${{ secrets.SIGNING_SECRET_FILE }} + RELEASER_NEXUS2_USERNAME: ${{ secrets.RELEASER_NEXUS2_USERNAME }} + RELEASER_NEXUS2_PASSWORD: ${{ secrets.RELEASER_NEXUS2_PASSWORD }} + with: + arguments: assemble sourcesJar javadocJar publishOSXArtifacts publish --stacktrace diff --git a/build.gradle.kts b/build.gradle.kts index fe3ce8c3..44e6166e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -196,34 +196,34 @@ subprojects { } } - withXml { - asNode().appendNode("dependencies").apply { - val dependencies = configurations.asMap["api"]?.dependencies ?: emptySet() - - for (dependency in dependencies) { - appendNode("dependency").apply { - appendNode("groupId", dependency.group) - appendNode("artifactId", dependency.name) - appendNode("version", dependency.version) - - val excludeRules = - if (dependency is ModuleDependency) dependency.excludeRules - else emptySet() - - if (excludeRules.isNotEmpty()) { - appendNode("exclusions").apply { - appendNode("exclusion").apply { - excludeRules.forEach { excludeRule -> - appendNode("groupId", excludeRule.group) - appendNode("artifactId", excludeRule.module) - } - } - } - } - } - } - } - } +// withXml { +// asNode().appendNode("dependencies").apply { +// val dependencies = configurations.asMap["api"]?.dependencies ?: emptySet() +// +// for (dependency in dependencies) { +// appendNode("dependency").apply { +// appendNode("groupId", dependency.group) +// appendNode("artifactId", dependency.name) +// appendNode("version", dependency.version) +// +// val excludeRules = +// if (dependency is ModuleDependency) dependency.excludeRules +// else emptySet() +// +// if (excludeRules.isNotEmpty()) { +// appendNode("exclusions").apply { +// appendNode("exclusion").apply { +// excludeRules.forEach { excludeRule -> +// appendNode("groupId", excludeRule.group) +// appendNode("artifactId", excludeRule.module) +// } +// } +// } +// } +// } +// } +// } +// } } } } @@ -244,6 +244,50 @@ subprojects { dependsOn(tasks.withType()) } + val publishWindowsArtifacts by tasks.registering { + dependsOn( + tasks + .withType() + .filter { it.name.contains("mingw", ignoreCase = true) } + ) + } + + val publishOSXArtifacts by tasks.registering { + val appleOs = listOf("ios", "macos", "watchos", "tvos") + + dependsOn( + tasks + .withType() + .filter { p -> + appleOs.any { p.name.contains(it, ignoreCase = true) } + } + ) + } + + val publishJvmArtifacts by tasks.registering { + dependsOn( + tasks + .withType() + .filter { it.name.contains("jvm", ignoreCase = true) } + ) + } + + val publishLinuxArtifacts by tasks.registering { + dependsOn( + tasks + .withType() + .filter { it.name.contains("linux", ignoreCase = true) } + ) + } + + val publishJsArtifacts by tasks.registering { + dependsOn( + tasks + .withType() + .filter { it.name.contains("js", ignoreCase = true) } + ) + } + signing { useInMemoryPgpKeys(signingKeyId, signingSecretKey, signingPassword) sign(publishing.publications)