Skip to content

Commit

Permalink
Merge pull request #38 from fleeksoft/kotlinx-io
Browse files Browse the repository at this point in the history
prepare for v0.1.3 publish
  • Loading branch information
itboy87 authored Jul 25, 2024
2 parents 347d57b + 01cdf4b commit 8b0c159
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 173 deletions.
67 changes: 19 additions & 48 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ name: Build
on:
push:
branches: [ "main" ]
paths-ignore: [ "**.md" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
pages: write
id-token: write
paths-ignore: [ "**.md" ]

jobs:
build:
Expand Down Expand Up @@ -40,54 +37,28 @@ jobs:
run: ./gradlew ${{ matrix.config.tasks }} --info
working-directory: ${{ github.workspace }}

release:
if: ${{ github.event_name != 'pull_request' }}
deploy:
if: github.ref == 'refs/heads/main'

runs-on: macos-latest
needs:
- build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: [ build ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup JDK 17
uses: actions/setup-java@v3
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
java-version: 17

- name: Setup gradle
uses: gradle/gradle-build-action@v2

- name: Setup Pages
uses: actions/configure-pages@v3

# - name: Write secrets to local.properties
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# echo mavenCentralUsername="${SONATYPE_USERNAME}" >> "local.properties"
# echo mavenCentralUsername="${SONATYPE_PASSWORD}" >> "local.properties"
# echo gpgKeyPassword="${GPG_KEY_PASSWORD}" >> "local.properties"
# echo gpgKeySecret="${GPG_KEY_SECRET}" >> "local.properties"
# env:
# SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
# SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
# GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }}

# - name: Release to sonatype
# run: ./gradlew publishAllPublicationsToMavenRepository

- name: Generate docs with dokka
run: ./gradlew dokkaHtmlMultiModule

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ github.workspace }}/build/dokka/htmlMultiModule
- uses: gradle/gradle-build-action@v3

- name: Release to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
- name: Deploy to Sonatype
run: ./gradlew publish --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
49 changes: 49 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish docs

on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy_docs:
if: ${{ github.event_name != 'pull_request' }}
runs-on: macos-latest
needs:
- build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Setup gradle
uses: gradle/gradle-build-action@v2

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Generate docs with dokka
run: ./gradlew dokkaHtmlMultiModule

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ github.workspace }}/build/dokka/htmlMultiModule

- name: Release to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ agp = "8.2.2" #kmp max gradle support 8.2 right now
kotlin = "2.0.0"
compileSdk = "34"
minSdk = "21"
libraryVersion = "0.1.2"
libraryVersion = "0.1.3"
ktor = "3.0.0-beta-2"
coroutines = "1.8.1"
kotlinx-io = "0.5.1"
kotlinxDatetime = "0.6.0"
codepoints = "0.9.0"
dokka = "1.9.20"
mavenPublish = "0.29.0"


[libraries]
Expand All @@ -31,3 +32,4 @@ codepoints = { module = "de.cketti.unicode:kotlin-codepoints-deluxe", version.re
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
84 changes: 23 additions & 61 deletions ksoup-network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.dokka)
id("maven-publish")
id("signing")
alias(libs.plugins.mavenPublish)
}

group = "com.fleeksoft.ksoup"
Expand Down Expand Up @@ -127,69 +126,32 @@ android {
}
}

publishing {
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = gradleLocalProperties(rootDir).getProperty("mavenCentralUsername")
password = gradleLocalProperties(rootDir).getProperty("mavenCentralPassword")
mavenPublishing {
coordinates("com.fleeksoft.ksoup", "ksoup-network", libs.versions.libraryVersion.get())
pom {
name.set("ksoup-network")
description.set("Ksoup is a Kotlin Multiplatform library for working with HTML and XML, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.")
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
}

val javadocJar =
tasks.register<Jar>("javadocJar") {
dependsOn(tasks.dokkaHtml)
archiveClassifier.set("javadoc")
from("${layout.buildDirectory}/dokka")
url.set("https://github.com/fleeksoft/ksoup")
issueManagement {
system.set("Github")
url.set("https://github.com/fleeksoft/ksoup/issues")
}

publications {
withType<MavenPublication> {
artifact(javadocJar)
pom {
name.set("ksoup-network")
description.set(
"Ksoup is a Kotlin Multiplatform library for working with HTML and XML, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.",
)
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
url.set("https://github.com/fleeksoft/ksoup")
issueManagement {
system.set("Github")
url.set("https://github.com/fleeksoft/ksoup/issues")
}
scm {
connection.set("https://github.com/fleeksoft/ksoup.git")
url.set("https://github.com/fleeksoft/ksoup")
}
developers {
developer {
name.set("Sabeeh Ul Hussnain")
email.set("[email protected]")
organization.set("Fleek Soft")
}
}
scm {
connection.set("https://github.com/fleeksoft/ksoup.git")
url.set("https://github.com/fleeksoft/ksoup")
}
developers {
developer {
name.set("Sabeeh Ul Hussnain Anjum")
email.set("[email protected]")
organization.set("Fleek Soft")
}
}
}
}

signing {
useInMemoryPgpKeys(
// File(rootDir, "gpg/private.key").readText(),
gradleLocalProperties(rootDir).getProperty("gpgKeySecret"),
gradleLocalProperties(rootDir).getProperty("gpgKeyPassword"),
)
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))
}
87 changes: 24 additions & 63 deletions ksoup/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties

plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.dokka)
id("maven-publish")
id("signing")
alias(libs.plugins.mavenPublish)
}

group = "com.fleeksoft.ksoup"
Expand Down Expand Up @@ -125,72 +122,36 @@ android {
}
}

publishing {
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = gradleLocalProperties(rootDir).getProperty("mavenCentralUsername")
password = gradleLocalProperties(rootDir).getProperty("mavenCentralPassword")
mavenPublishing {
coordinates("com.fleeksoft.ksoup", "ksoup", libs.versions.libraryVersion.get())
pom {
name.set("ksoup")
description.set("Ksoup is a Kotlin Multiplatform library for working with HTML and XML, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.")
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
}

val javadocJar =
tasks.register<Jar>("javadocJar") {
dependsOn(tasks.dokkaHtml)
archiveClassifier.set("javadoc")
from("${layout.buildDirectory}/dokka")
}

publications {
withType<MavenPublication> {
artifact(javadocJar)
pom {
name.set("Ksoup")
description.set(
"Ksoup is a Kotlin Multiplatform library for working with HTML and XML, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.",
)
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
url.set("https://github.com/fleeksoft/ksoup")
issueManagement {
system.set("Github")
url.set("https://github.com/fleeksoft/ksoup/issues")
}
scm {
connection.set("https://github.com/fleeksoft/ksoup.git")
url.set("https://github.com/fleeksoft/ksoup")
}
developers {
developer {
name.set("Sabeeh Ul Hussnain")
email.set("[email protected]")
organization.set("Fleek Soft")
}
}
url.set("https://github.com/fleeksoft/ksoup")
issueManagement {
system.set("Github")
url.set("https://github.com/fleeksoft/ksoup/issues")
}
scm {
connection.set("https://github.com/fleeksoft/ksoup.git")
url.set("https://github.com/fleeksoft/ksoup")
}
developers {
developer {
name.set("Sabeeh Ul Hussnain Anjum")
email.set("[email protected]")
organization.set("Fleek Soft")
}
}
}
}

signing {
useInMemoryPgpKeys(
// File(rootDir, "gpg/private.key").readText(),
gradleLocalProperties(rootDir).getProperty("gpgKeySecret"),
gradleLocalProperties(rootDir).getProperty("gpgKeyPassword"),
)
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))
}
val isGithubActions: Boolean = System.getenv("GITHUB_ACTIONS")?.toBoolean() == true
val generateBuildConfigFile: Task by tasks.creating {
group = "build setup"
Expand Down

0 comments on commit 8b0c159

Please sign in to comment.