-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from MohamedRejeb/0.x
Add convention plugins and new targets
- Loading branch information
Showing
10 changed files
with
244 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Deploy to central | ||
|
||
on: workflow_dispatch | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/gradle.yml | ||
deploy: | ||
needs: build | ||
strategy: | ||
matrix: | ||
include: | ||
- target: publishAllPublicationsToSonatypeRepository | ||
os: macos-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Validate Gradle Wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.konan | ||
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }} | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Gradle publish | ||
uses: gradle/gradle-build-action@ce999babab2de1c4b649dc15f0ee67e6246c994f | ||
with: | ||
arguments: | | ||
${{ matrix.target }} | ||
closeAndReleaseSonatypeStagingRepository | ||
env: | ||
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | ||
OSSRH_GPG_SECRET_KEY_ID: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }} | ||
OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.nexus.publish) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
pluginManagement { | ||
repositories { | ||
google() | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
|
||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
convention-plugins/src/main/kotlin/module.publication.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.api.tasks.bundling.Jar | ||
import org.gradle.kotlin.dsl.`maven-publish` | ||
|
||
plugins { | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
publishing { | ||
// Configure all publications | ||
publications.withType<MavenPublication> { | ||
// Stub javadoc.jar artifact | ||
artifact(tasks.register("${name}JavadocJar", Jar::class) { | ||
archiveClassifier.set("javadoc") | ||
archiveAppendix.set(this@withType.name) | ||
}) | ||
|
||
// Provide artifacts information required by Maven Central | ||
pom { | ||
name.set("Ksoup") | ||
description.set("A lightweight Kotlin Multiplatform library to parse HTML/XML data.") | ||
url.set("https://github.com/MohamedRejeb/Ksoup") | ||
|
||
licenses { | ||
license { | ||
name.set("Apache-2.0") | ||
url.set("https://opensource.org/licenses/Apache-2.0") | ||
} | ||
} | ||
issueManagement { | ||
system.set("Github") | ||
url.set("https://github.com/MohamedRejeb/Ksoup/issues") | ||
} | ||
scm { | ||
connection.set("https://github.com/MohamedRejeb/Ksoup.git") | ||
url.set("https://github.com/MohamedRejeb/Ksoup") | ||
} | ||
developers { | ||
developer { | ||
id.set("MohamedRejeb") | ||
name.set("Mohamed Rejeb") | ||
email.set("mohamedrejeb445@gmail.com") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
System.getenv("OSSRH_GPG_SECRET_KEY_ID"), | ||
System.getenv("OSSRH_GPG_SECRET_KEY"), | ||
System.getenv("OSSRH_GPG_SECRET_KEY_PASSWORD"), | ||
) | ||
sign(publishing.publications) | ||
} | ||
|
||
// TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed | ||
project.tasks.withType(AbstractPublishToMaven::class.java).configureEach { | ||
dependsOn(project.tasks.withType(Sign::class.java)) | ||
} |
22 changes: 22 additions & 0 deletions
22
convention-plugins/src/main/kotlin/root.publication.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
plugins { | ||
id("io.github.gradle-nexus.publish-plugin") | ||
} | ||
|
||
allprojects { | ||
group = "com.mohamedrejeb.ksoup" | ||
version = "0.3.0" | ||
} | ||
|
||
nexusPublishing { | ||
// Configure maven central repository | ||
// https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
stagingProfileId.set(System.getenv("OSSRH_STAGING_PROFILE_ID")) | ||
username.set(System.getenv("OSSRH_USERNAME")) | ||
password.set(System.getenv("OSSRH_PASSWORD")) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
[versions] | ||
agp = "8.1.0" | ||
kotlin = "1.9.21" | ||
kotlinx-kover = "0.7.4" | ||
|
||
android-minSdk = "21" | ||
android-compileSdk = "34" | ||
|
||
nexus-publish = "2.0.0-rc-1" | ||
|
||
[libraries] | ||
nexus-publish = { module = "io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin", version.ref = "nexus-publish" } | ||
|
||
[plugins] | ||
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } | ||
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlinx-kover" } | ||
androidLibrary = { id = "com.android.library", version.ref = "agp" } | ||
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlinx-kover" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.