From bd5b5f4ef78164fa09f1ade9155fa03aa3801e92 Mon Sep 17 00:00:00 2001 From: Floern Date: Sun, 7 Nov 2021 19:06:24 +0100 Subject: [PATCH] release to maven central instead of jcenter --- .github/workflows/publish.yml | 14 +++-- README.md | 6 +- build.gradle.kts | 80 +++++++----------------- gradle.properties | 30 +++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 65 insertions(+), 67 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 53c72b3..a5c2e22 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,11 +9,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: '11' - name: Grant permission to execute run: chmod +x gradlew - - name: Publish Library - run: ./gradlew bintrayUpload -PbintrayUser=${{secrets.BINTRAY_USER}} -PbintrayKey=${{secrets.BINTRAY_KEY}} + - name: Upload + run: | + echo "${{secrets.MAVEN_SIGNING_KEY_ARMOR_ASC}}" > ./signingkey.asc + gpg --quiet --output $GITHUB_WORKSPACE/signingkey.gpg --dearmor ./signingkey.asc + ./gradlew publish -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/signingkey.gpg -Psigning.password='${{secrets.MAVEN_SIGNING_KEY_PASSPHRASE}}' -Psigning.keyId=${{secrets.MAVEN_SIGNING_KEY_ID}} -PmavenCentralUsername=${{secrets.MAVEN_CENTRAL_USERNAME}} -PmavenCentralPassword=${{secrets.MAVEN_CENTRAL_PASSWORD}} + - name: Close and release Sonatype repository + if: ${{ success() }} + run: ./gradlew closeAndReleaseRepository -PmavenCentralUsername=${{secrets.MAVEN_CENTRAL_USERNAME}} -PmavenCentralPassword=${{secrets.MAVEN_CENTRAL_PASSWORD}} diff --git a/README.md b/README.md index d9a0755..a33b1f8 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,18 @@ A simple Kotlin library to read and write CSV directly from and to data classes with a single line of code. -[![Release](https://img.shields.io/bintray/v/floern/maven/casting-csv-kt?label=release)](https://bintray.com/floern/maven/casting-csv-kt) +[![Release](https://img.shields.io/maven-central/v/com.floern.castingcsv/casting-csv-kt?label=release)](https://bintray.com/floern/maven/casting-csv-kt) [![CI](https://img.shields.io/github/workflow/status/Floern/casting-csv-kt/CI/main?label=ci)](https://github.com/Floern/casting-csv-kt/actions?query=workflow%3ACI) ## Usage ### Dependency -The library artifact is available on JCenter. +The library artifact is available on Maven Central. Gradle: ```kotlin -implementation "com.floern.castingcsv:casting-csv-kt:1.1" +implementation "com.floern.castingcsv:casting-csv-kt:1.2" ``` ### Example preliminaries diff --git a/build.gradle.kts b/build.gradle.kts index 3126ab5..857ecb0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,33 +1,34 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -val artifactGroup = "com.floern.castingcsv" -val artifactName = "casting-csv-kt" -val artifactVersion = "1.1" -val publicationName = "release" - buildscript { - dependencies { - classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin") + repositories { + mavenCentral() } } plugins { - kotlin("jvm") version "1.4.10" - id("com.jfrog.bintray") version "1.8.5" - id("maven-publish") + kotlin("jvm") version "1.5.31" + id("com.vanniktech.maven.publish") version "0.18.0" } -group = artifactGroup -version = artifactVersion +val GROUP: String by project +val VERSION_NAME: String by project + +group = GROUP +version = VERSION_NAME kotlin { explicitApi() } -tasks.withType { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } +val compileKotlin: KotlinCompile by tasks +compileKotlin.kotlinOptions { + jvmTarget = "1.8" +} + +val compileTestKotlin: KotlinCompile by tasks +compileTestKotlin.kotlinOptions { + jvmTarget = "1.8" } repositories { @@ -35,49 +36,10 @@ repositories { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.10") - implementation("com.github.doyaaaaaken:kotlin-csv-jvm:0.11.1") - - testImplementation(kotlin("test-junit")) -} + implementation(kotlin("stdlib-jdk8")) + implementation(kotlin("reflect")) -val sourcesJar by tasks.creating(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets.main.get().allSource) -} + implementation("com.github.doyaaaaaken:kotlin-csv-jvm:1.2.0") -publishing { - publications { - create(publicationName) { - groupId = artifactGroup - artifactId = artifactName - version = artifactVersion - from(components["java"]) - artifact(sourcesJar) - } - } + testImplementation(kotlin("test-junit")) } - -bintray { - user = findProperty("bintrayUser") as String? - key = findProperty("bintrayKey") as String? - - setPublications(publicationName) - publish = true - - pkg.apply { - repo = "maven" - name = artifactName - vcsUrl = "https://github.com/Floern/casting-csv-kt.git" - websiteUrl = "https://github.com/Floern/casting-csv-kt" - issueTrackerUrl = "https://github.com/Floern/casting-csv-kt/issues" - githubRepo = "Floern/casting-csv-kt" - githubReleaseNotesFile = "README.md" - setLicenses("Apache-2.0") - setLabels("kotlin", "csv") - - version.apply { - name = artifactVersion - } - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7fc6f1f..e981f9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,31 @@ kotlin.code.style=official + +# Artifact metadata +GROUP=com.floern.castingcsv +POM_ARTIFACT_ID=casting-csv-kt +VERSION_NAME=1.2 + +# POM metadata +POM_NAME=casting-csv-kt +POM_PACKAGING=jar +POM_DESCRIPTION=Read and write CSV directly from and to Kotlin data classes. +POM_INCEPTION_YEAR=2020 + +# POM URLs +POM_URL=https://github.com/Floern/casting-csv-kt +POM_SCM_URL=https://github.com/Floern/casting-csv-kt +POM_SCM_CONNECTION=scm:git@github.com:Floern/casting-csv-kt.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:Floern/casting-csv-kt.git + +# License information +POM_LICENCE_NAME=License +POM_LICENCE_URL=https://github.com/Floern/casting-csv-kt/blob/main/LICENSE +POM_LICENCE_DIST=repo + +# Developer information +POM_DEVELOPER_ID=Floern +POM_DEVELOPER_NAME=Floern +POM_DEVELOPER_URL=https://floern.com/ + +# Sonatype metadata +SONATYPE_STAGING_PROFILE=com.floern diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4b4429..6c9a224 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists