Skip to content

Commit

Permalink
Merge pull request #5 from Floern/feature/mavencentral-release
Browse files Browse the repository at this point in the history
Publish to Maven Central
  • Loading branch information
Floern authored Nov 7, 2021
2 parents f343e78 + bd5b5f4 commit 7afff5a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 67 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
80 changes: 21 additions & 59 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,83 +1,45 @@
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<KotlinCompile> {
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 {
mavenCentral()
}

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<MavenPublication>(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
}
}
}
30 changes: 30 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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:[email protected]:Floern/casting-csv-kt.git
POM_SCM_DEV_CONNECTION=scm:[email protected]: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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7afff5a

Please sign in to comment.