Skip to content

Commit

Permalink
configure package publishing to github
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmazKo committed Jul 5, 2020
1 parent 0b1a411 commit d0de1ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 70 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ jobs:
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true

- name: Publish
run: ./gradlew publish -Ppub.user="${{secrets.GH_USERNAME}}" -Ppub.token="${{secrets.GH_TOKEN}}"
86 changes: 16 additions & 70 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import java.util.*

plugins {
java
jacoco
`maven-publish`
id("com.jfrog.bintray") version "1.8.5"
}

group = "almazko"
version = "0.6"
version = "0.6.2-SNAPSHOT"

repositories {
mavenCentral()
Expand Down Expand Up @@ -84,80 +81,29 @@ val sourcesJar by tasks.creating(Jar::class) {
from(sourceSets.getByName("main").allSource)
}


val artifactName = project.name
val artifactGroup = project.group.toString()
val artifactVersion = project.version.toString()
val baseUrl = "https://github.com/AlmazKo/microjson"
val pomUrl = baseUrl
val pomScmUrl = baseUrl
val pomIssueUrl = "$baseUrl/issues"
val pomDesc = baseUrl
val githubRepo = "AlmazKo/microjson"
val githubReadme = "README.md"
val pomLicenseName = "MIT"
val pomLicenseUrl = "https://opensource.org/licenses/mit-license.php"
val pomLicenseDist = "repo"
val pomDeveloperId = "AlmazKo"
val pomDeveloperName = "Alex Suslov"


publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/almazko/microjson")
credentials {
username = project.findProperty("pub.user")?.toString()
password = project.findProperty("pub.token")?.toString()
}
}
}
publications {
create<MavenPublication>("microjson") {
groupId = artifactGroup
artifactId = artifactName
version = artifactVersion
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
artifact(sourcesJar)
pom.withXml {
asNode().apply {
appendNode("description", pomDesc)
appendNode("name", rootProject.name)
appendNode("url", pomUrl)
appendNode("licenses").appendNode("license").apply {
appendNode("name", pomLicenseName)
appendNode("url", pomLicenseUrl)
appendNode("distribution", pomLicenseDist)
}
appendNode("developers").appendNode("developer").apply {
appendNode("id", pomDeveloperId)
appendNode("name", pomDeveloperName)
}
appendNode("scm").apply {
appendNode("url", pomScmUrl)
}
appendNode("name", artifactId)
appendNode("url", "https://github.com/AlmazKo/microjson")
}
}
}
}
}


bintray {
user = project.findProperty("bintrayUser").toString()
key = project.findProperty("bintrayKey").toString()
publish = true
setPublications("microjson")
pkg.apply {
repo = "micro"
name = artifactName
userOrg = "almazko"
githubRepo = githubRepo
vcsUrl = pomScmUrl
description = "JSON tiny library written in modern Java"
setLabels("json-parser")
setLicenses("MIT")
desc = description
websiteUrl = pomUrl
issueTrackerUrl = pomIssueUrl
githubReleaseNotesFile = githubReadme

version.apply {
name = artifactVersion
desc = pomDesc
released = Date().toString()
vcsTag = artifactVersion
}
}
}

0 comments on commit d0de1ca

Please sign in to comment.