Skip to content

Commit

Permalink
Configure OSX and Windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
gabfssilva committed Jan 22, 2024
1 parent b2305d1 commit 7794a16
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 29 deletions.
52 changes: 51 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
100 changes: 72 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
// }
// }
// }
// }
// }
// }
// }
// }
}
}
}
Expand All @@ -244,6 +244,50 @@ subprojects {
dependsOn(tasks.withType<Sign>())
}

val publishWindowsArtifacts by tasks.registering {
dependsOn(
tasks
.withType<PublishToMavenRepository>()
.filter { it.name.contains("mingw", ignoreCase = true) }
)
}

val publishOSXArtifacts by tasks.registering {
val appleOs = listOf("ios", "macos", "watchos", "tvos")

dependsOn(
tasks
.withType<PublishToMavenRepository>()
.filter { p ->
appleOs.any { p.name.contains(it, ignoreCase = true) }
}
)
}

val publishJvmArtifacts by tasks.registering {
dependsOn(
tasks
.withType<PublishToMavenRepository>()
.filter { it.name.contains("jvm", ignoreCase = true) }
)
}

val publishLinuxArtifacts by tasks.registering {
dependsOn(
tasks
.withType<PublishToMavenRepository>()
.filter { it.name.contains("linux", ignoreCase = true) }
)
}

val publishJsArtifacts by tasks.registering {
dependsOn(
tasks
.withType<PublishToMavenRepository>()
.filter { it.name.contains("js", ignoreCase = true) }
)
}

signing {
useInMemoryPgpKeys(signingKeyId, signingSecretKey, signingPassword)
sign(publishing.publications)
Expand Down

0 comments on commit 7794a16

Please sign in to comment.